WP Photo Album Plus - Version 6.9.20

Version Description

  • This version addresses various bug fixes
Download this release

Release Info

Developer opajaap
Plugin Icon wp plugin WP Photo Album Plus
Version 6.9.20
Comparing to
See all releases

Code changes from version 6.9.19 to 6.9.20

changelog.txt CHANGED
@@ -1,5 +1,13 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
3
  = 6.9.19 =
4
 
5
  = Bug Fixes =
1
  WP Photo Album Plus Changelog
2
 
3
+ = 6.9.20 =
4
+
5
+ = Bug Fixes =
6
+
7
+ * Fixed erroneously reported unsafe filepaths found and hence inability to upload/import in certain configurations.
8
+ * WPPA logging will no longer generate errormessages.
9
+ * Fixed db prefix issue for multisite global installations, resulting in a.o. inability to edit album and photo information.
10
+
11
  = 6.9.19 =
12
 
13
  = Bug Fixes =
js/wppa-slideshow.js CHANGED
@@ -3,7 +3,7 @@
3
  // Contains slideshow modules
4
  // Dependancies: wppa.js and default wp jQuery library
5
  //
6
- var wppaJsSlideshowVersion = '6.9.06';
7
 
8
  // This is an entrypoint to load the slide data
9
  function wppaStoreSlideInfo(
@@ -428,10 +428,53 @@ function _wppaNextSlide( mocc, mode ) {
428
  fontWeight: wppaFontWeightNumbarActive
429
  });
430
 
431
- // too many? all dots except current
432
  if ( _wppaSlides[mocc].length > wppaNumbarMax ) {
433
- jQuery( '[id^=wppa-numbar-' + mocc + '-]' ).html( ' . ' );
434
- jQuery( "#wppa-numbar-" + mocc + "-" + _wppaNxtIdx[mocc] ).html( ' ' + ( _wppaNxtIdx[mocc]+1 ) + ' ' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  }
436
 
437
  // first:
3
  // Contains slideshow modules
4
  // Dependancies: wppa.js and default wp jQuery library
5
  //
6
+ var wppaJsSlideshowVersion = '6.9.20';
7
 
8
  // This is an entrypoint to load the slide data
9
  function wppaStoreSlideInfo(
428
  fontWeight: wppaFontWeightNumbarActive
429
  });
430
 
431
+ // too many?
432
  if ( _wppaSlides[mocc].length > wppaNumbarMax ) {
433
+
434
+ var lo, hi, mx = _wppaSlides[mocc].length - 1, is = _wppaNxtIdx[mocc], arm = ( wppaNumbarMax - 1 ) / 2;
435
+
436
+ // Near left
437
+ if ( is < arm ) {
438
+ lo = 0;
439
+ hi = wppaNumbarMax - 1 - 1;
440
+ jQuery( "#wppa-nbar-"+ mocc + "-lodots" ).css({display:'none'});
441
+ jQuery( "#wppa-nbar-"+ mocc + "-hidots" ).css({display:'block'});
442
+ }
443
+ // Near right
444
+ else if ( is > ( mx - arm ) ) {
445
+ hi = mx;
446
+ lo = mx - wppaNumbarMax + 1 + 1;
447
+ jQuery( "#wppa-nbar-"+ mocc + "-lodots" ).css({display:'block'});
448
+ jQuery( "#wppa-nbar-"+ mocc + "-hidots" ).css({display:'none'});
449
+ }
450
+ // near center
451
+ else {
452
+ lo = is - arm + 1;
453
+ hi = is + arm + 0.5 - 1;
454
+ if ( lo < 2 ) {
455
+ jQuery( "#wppa-nbar-"+ mocc + "-lodots" ).css({display:'none'});
456
+ jQuery( "#wppa-nbar-"+ mocc + "-hidots" ).css({display:'block'});
457
+ }
458
+ else if ( hi > mx - 1 ) {
459
+ jQuery( "#wppa-nbar-"+ mocc + "-lodots" ).css({display:'block'});
460
+ jQuery( "#wppa-nbar-"+ mocc + "-hidots" ).css({display:'none'});
461
+
462
+ }
463
+ else {
464
+ jQuery( "#wppa-nbar-"+ mocc + "-lodots" ).css({display:'block'});
465
+ jQuery( "#wppa-nbar-"+ mocc + "-hidots" ).css({display:'block'});
466
+ }
467
+ }
468
+ var i = 0;
469
+ while ( i < _wppaSlides[mocc].length ) {
470
+ if ( i != 0 && i != mx && ( i < lo || i > hi ) ) {
471
+ jQuery( "#wppa-numbar-" + mocc + "-" + i ).css({display:'none'});
472
+ }
473
+ else {
474
+ jQuery( "#wppa-numbar-" + mocc + "-" + i ).css({display:'block'});
475
+ }
476
+ i++;
477
+ }
478
  }
479
 
480
  // first:
js/wppa-slideshow.min.js CHANGED
@@ -1 +1 @@
1
- var wppaJsSlideshowVersion="6.9.06";function wppaStoreSlideInfo(p,a,e,t,i,w,r,o,n,l,s,d,u,_,m,c,y,h,S,x,f,g,I,j,Q,b,v,N,T,C,k){var R,L;(n=wppaRepairScriptTags(n),_wppaSlides[p]&&"0"!=a||(_wppaSlides[p]=[],_wppaNames[p]=[],_wppaFullNames[p]=[],_wppaDsc[p]=[],_wppaOgDsc[p]=[],_wppaCurIdx[p]=-1,_wppaNxtIdx[p]=0,"random"==h?_wppaTimeOut[p]="random":0<parseInt(h)?_wppaTimeOut[p]=parseInt(h):_wppaTimeOut[p]=wppaSlideShowTimeOut,_wppaSSRuns[p]=!1,_wppaTP[p]=-2,_wppaFg[p]=0,_wppaIsBusy[p]=!1,_wppaFirst[p]=!0,_wppaId[p]=[],_wppaAvg[p]=[],_wppaDisc[p]=[],_wppaMyr[p]=[],_wppaVRU[p]=[],_wppaLinkUrl[p]=[],_wppaLinkTitle[p]=[],_wppaLinkTarget[p]=[],_wppaCommentHtml[p]=[],_wppaIptcHtml[p]=[],_wppaExifHtml[p]=[],_wppaUrl[p]=[],_wppaSkipRated[p]=!1,_wppaLbTitle[p]=[],_wppaDidGoto[p]=!1,wppaSlidePause[p]=!1,_wppaShareUrl[p]=[],_wppaShareHtml[p]=[],_wppaFilmNoMove[p]=!1,_wppaHiresUrl[p]=[],_wppaIsVideo[p]=[],_wppaVideoHtml[p]=[],_wppaAudioHtml[p]=[],_wppaVideoNatWidth[p]=[],_wppaVideoNatHeight[p]=[],wppaVideoPlaying[p]=!1,wppaAudioPlaying[p]=!1,_wppaWaitTexts[p]=[],_wppaImageAlt[p]=[]),R="default",""!=m?R="pointer":""!=wppaLightBox[p]&&(R="url( "+wppaImageDirectory+wppaMagnifierCursor+" ),pointer"),_wppaIsVideo[p][a]=""!=v,_wppaIsVideo[p][a]?(_wppaSlides[p][a]=' alt="'+C+'" class="theimg theimg-'+p+' big" ',wppaSlideVideoStart&&""==wppaLightBox[p]&&(_wppaSlides[p][a]+=" autoplay "),0<k.length&&(_wppaSlides[p][a]+=' poster="'+k+'" ')):_wppaSlides[p][a]=' src="'+e+'" alt="'+C+'" class="theimg theimg-'+p+' big stereo" ',wppaSlideSwipe&&(_wppaSlides[p][a]+=' ontouchstart="wppaTouchStart( event, this.id, '+p+' );" ontouchend="wppaTouchEnd( event );" ontouchmove="wppaTouchMove( event );" ontouchcancel="wppaTouchCancel( event );" '),wppaAutoColumnWidth[p]||(_wppaSlides[p][a]+='width="'+i+'" height="'+w+'" '),_wppaIsVideo[p][a])?(L="wppa"==wppaLightBox[p]?"":"controls",_wppaSlides[p][a]+='style="'+t+"; cursor:"+R+'; display:none;" '+L+">"+v+"</video>"):_wppaSlides[p][a]+='style="'+t+"; cursor:"+R+'; display:none; vertical-align:middle;">';_wppaFullNames[p][a]=wppaRepairBrTags(r),_wppaNames[p][a]=o,_wppaDsc[p][a]=n,_wppaOgDsc[p][a]=Q,_wppaId[p][a]=l,_wppaAvg[p][a]=s,_wppaDisc[p][a]=d,_wppaMyr[p][a]=u,_wppaVRU[p][a]=_,_wppaLinkUrl[p][a]=m,_wppaLinkTitle[p][a]=c,""!=y?_wppaLinkTarget[p][a]=y:wppaSlideBlank[p]?_wppaLinkTarget[p][a]="_blank":_wppaLinkTarget[p][a]="_self",_wppaCommentHtml[p][a]=S,_wppaIptcHtml[p][a]=x,_wppaExifHtml[p][a]=f,_wppaUrl[p][a]=e,_wppaLbTitle[p][a]=wppaRepairScriptTags(g),_wppaShareUrl[p][a]=I,_wppaShareHtml[p][a]=wppaRepairScriptTags(j),_wppaHiresUrl[p][a]=b,_wppaVideoHtml[p][a]=v,_wppaAudioHtml[p][a]=N,_wppaVideoNatWidth[p][a]=i,_wppaVideoNatHeight[p][a]=w,_wppaWaitTexts[p][a]=T,_wppaImageAlt[p][a]=C}function wppaSpeed(p,a){_wppaSSRuns[p]&&_wppaSpeed(p,a)}function wppaStopShow(p){_wppaSSRuns[p]&&_wppaStop(p)}function wppaStartStop(p,a){_wppaIsBusy[p]?_wppaTP[p]=a:(_wppaSSRuns[p]?(_wppaStop(p),jQuery("#wppa-startstop-icon-"+p).html(wppaSvgHtml("Play-Button",wppaIconSize(p,"48px",!0),!1,!0,"0","10","50","50"))):(_wppaStart(p,a),-1==a&&jQuery("#wppa-startstop-icon-"+p).html(wppaSvgHtml("Pause-Button",wppaIconSize(p,"48px",!0),!1,!0,"0","10","50","50"))),wppaIsMobile&&(jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(10,1).fadeTo(3e3,0),jQuery(".ubb-"+p).stop().fadeTo(10,1).fadeTo(3e3,0)))}function wppaBbb(p,a,e){_wppaSSRuns[p]||_wppaBbb(p,a,e)}function wppaUbb(p,a,e){_wppaUbb(p,a,e)}function wppaRateIt(p,a){_wppaRateIt(p,a)}function wppaOvlRateIt(p,a,e,t){_wppaOvlRateIt(p,a,e,t)}function wppaPrev(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaPrev(p)}function wppaPrevN(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaPrevN(p,a)}function wppaFirst(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaGoto(p,0)}function wppaNext(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaNext(p)}function wppaNextN(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaNextN(p,a)}function wppaLast(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaGoto(p,_wppaSlides[p].length-1)}function wppaFollowMe(p,a){_wppaSSRuns[p]||_wppaFollowMe(p,a)}function wppaLeaveMe(p,a){_wppaSSRuns[p]||_wppaLeaveMe(p,a)}function wppaGoto(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaGoto(p,a)}function wppaGotoFilmNoMove(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||(_wppaFilmNoMove[p]=!0,_wppaGoto(p,a))}function wppaGotoKeepState(p,a){_wppaNxtIdx[p]!=a&&(_wppaDidGoto[p]=!0,_wppaGotoKeepState(p,a))}function _wppaGotoKeepState(p,a){_wppaSSRuns[p]?_wppaGotoRunning(p,a):_wppaGoto(p,a)}function wppaGotoRunning(p,a){_wppaDidGoto[p]=!0,_wppaGotoRunning(p,a)}function wppaValidateComment(p){return _wppaValidateComment(p)}function _wppaNextSlide(p,a){var e=_wppaFg[p],t=1-e;if((wppaVideoPlaying[p]||wppaAudioPlaying[p])&&_wppaSSRuns[p])setTimeout("_wppaNextSlide( "+p+", '"+a+"' )",500);else{if(wppaStopVideo(p),wppaStopAudio(p),"auto"==a){if(wppaSlidePause[p])return jQuery("#theimg"+e+"-"+p).attr("title",wppaSlidePause[p]),jQuery("#slide_frame-"+p).attr("title",wppaSlidePause[p]),void setTimeout("_wppaNextSlide( "+p+', "auto" )',250)}else jQuery("#slide_frame-"+p).removeAttr("title");if((_wppaSSRuns[p]||"auto"!=a)&&_wppaSlides[p]&&(!(_wppaSlides[p].length<2)||_wppaFirst[p])){if(_wppaSSRuns[p]||"reset"!=a||(_wppaSSRuns[p]=!0,__wppaOverruleRun=!1),_wppaVoteInProgress=!1,_wppaIsBusy[p]=!0,_wppaSSRuns[p]&&_wppaShowMetaData(p,"hide"),_wppaSSRuns[p]&&(_wppaNxtIdx[p]=_wppaCurIdx[p]+1,_wppaNxtIdx[p]==_wppaSlides[p].length&&(_wppaNxtIdx[p]=0)),jQuery("#geodiv-"+p+"-"+_wppaId[p][_wppaCurIdx[p]]).css({display:"none"}),jQuery("#geodiv-"+p+"-"+_wppaId[p][_wppaNxtIdx[p]]).css({display:""}),"undefined"!=typeof _wppaLat&&_wppaLat[p]&&_wppaLat[p][_wppaId[p][_wppaNxtIdx[p]]]?(jQuery("#map-canvas-"+p).css("display",""),wppaGeoInit(p,_wppaLat[p][_wppaId[p][_wppaNxtIdx[p]]],_wppaLon[p][_wppaId[p][_wppaNxtIdx[p]]])):jQuery("#map-canvas-"+p).css("display","none"),jQuery("[id^=wppa-numbar-"+p+"-]").css({backgroundColor:wppaBGcolorNumbar,borderColor:wppaBcolorNumbar,fontFamily:wppaFontFamilyNumbar,fontSize:wppaFontSizeNumbar,color:wppaFontColorNumbar,fontWeight:wppaFontWeightNumbar}),jQuery("#wppa-numbar-"+p+"-"+_wppaNxtIdx[p]).css({backgroundColor:wppaBGcolorNumbarActive,borderColor:wppaBcolorNumbarActive,fontFamily:wppaFontFamilyNumbarActive,fontSize:wppaFontSizeNumbarActive,color:wppaFontColorNumbarActive,fontWeight:wppaFontWeightNumbarActive}),_wppaSlides[p].length>wppaNumbarMax&&(jQuery("[id^=wppa-numbar-"+p+"-]").html(" . "),jQuery("#wppa-numbar-"+p+"-"+_wppaNxtIdx[p]).html(" "+(_wppaNxtIdx[p]+1)+" ")),_wppaFirst[p]){if(-1!=_wppaCurIdx[p]&&wppaMakeTheSlideHtml(p,"0",_wppaCurIdx[p]),wppaMakeTheSlideHtml(p,"1",_wppaNxtIdx[p]),jQuery("#imagedesc-"+p).html(_wppaDsc[p][_wppaCurIdx[p]]),jQuery("#imagetitle-"+p).html(wppaMakeNameHtml(p)),jQuery("#wppa-comments-"+p).html(_wppaCommentHtml[p][_wppaCurIdx[p]]),jQuery("#iptc-"+p).html(_wppaIptcHtml[p][_wppaCurIdx[p]]),jQuery("#exif-"+p).html(_wppaExifHtml[p][_wppaCurIdx[p]]),"icons"==wppaSlideshowNavigationType){var i=wppaIconSize(p,"1.5em",!1);jQuery("#prev-arrow-"+p).html(wppaSvgHtml("Prev-Button",i,!1,!0)),jQuery("#next-arrow-"+p).html(wppaSvgHtml("Next-Button",i,!1,!0))}else wppaIsMini[p]||wppaGetContainerWidth(p)<wppaMiniTreshold?(jQuery("#prev-arrow-"+p).html("&laquo;&nbsp;"+wppaPrevP),jQuery("#next-arrow-"+p).html(wppaNextP+"&nbsp;&raquo;")):(jQuery("#prev-arrow-"+p).html("&laquo;&nbsp;"+wppaPreviousPhoto),jQuery("#next-arrow-"+p).html(wppaNextPhoto+"&nbsp;&raquo;"));wppaIsMini[p]||wppaGetContainerWidth(p)<wppaMiniTreshold?(jQuery("#wppa-avg-rat-"+p).html(wppaAvgRat),jQuery("#wppa-my-rat-"+p).html(wppaMyRat)):(jQuery("#wppa-avg-rat-"+p).html(wppaAvgRating),jQuery("#wppa-my-rat-"+p).html(wppaMyRating))}else wppaMakeTheSlideHtml(p,t,_wppaNxtIdx[p]);_wppaLoadSpinner(p),_wppaFirst[p]=!1,_wppaCheckRewind(p),wppaColWidth[p]=0,_wppaDoAutocol(p),setTimeout("_wppaNextSlide_2( "+p+" )",10)}}}function _wppaNextSlide_2(p){var a=_wppaFg[p],e=1-a,t=document.getElementById("theimg"+e+"-"+p);if(t&&1==t.nodeType&&"IMG"==t.nodeName&&!t.complete)return setTimeout("_wppaNextSlide_2( "+p+" )",200),void wppaConsoleLog("Retry next2");wppaUpdateLightboxes(),_wppaUnloadSpinner(p),-1!=_wppaSSRuns[p]&&(_wppaToTheSame||_wppaShowMetaData(p,"hide")),_wppaFg[p]=1-_wppaFg[p],e=1-(a=_wppaFg[p]),setTimeout("_wppaNextSlide_3( "+p+" )",10)}function _wppaNextSlide_3(p){var a=_wppaFg[p],e=1-a,t=_wppaCurIdx[p],i=_wppaNxtIdx[p],w="#theslide"+e+"-"+p,r="#theslide"+a+"-"+p,o="#theimg"+e+"-"+p,n="#theimg"+a+"-"+p,l=parseInt(jQuery(w).css("width")),s="nil";switch(t==i&&(s="none"),t==i-1&&(s="left"),t==i+1&&(s="right"),t==_wppaSlides[p].length-1&&0==i&&wppaSlideWrap[p]&&(s="left"),0==t&&i==_wppaSlides[p].length-1&&wppaSlideWrap[p]&&(s="right"),"nil"==s&&(s=t<i?"left":"right"),jQuery(w).css({marginLeft:0,width:l}),jQuery(r).css({marginLeft:0,width:l}),wppaFormatSlide(p),wppaAnimationType){case"fadeover":jQuery(o).fadeOut(wppaAnimationSpeed),jQuery(n).fadeIn(wppaAnimationSpeed,_wppaNextSlide_4(p));break;case"fadeafter":jQuery(o).fadeOut(wppaAnimationSpeed),jQuery(n).delay(wppaAnimationSpeed).fadeIn(wppaAnimationSpeed,_wppaNextSlide_4(p));break;case"swipe":switch(s){case"left":jQuery(w).animate({marginLeft:-l+"px"},wppaAnimationSpeed,"swing"),jQuery(r).css({marginLeft:l+"px"}),jQuery(n).fadeIn(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"right":jQuery(w).animate({marginLeft:l+"px"},wppaAnimationSpeed,"swing"),jQuery(r).css({marginLeft:-l+"px"}),jQuery(n).fadeIn(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;case"stackon":switch(s){case"left":jQuery(w).css({zIndex:80}),jQuery(r).css({marginLeft:l+"px",zIndex:81}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"right":jQuery(w).css({zIndex:80}),jQuery(r).css({marginLeft:-l+"px",zIndex:81}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;case"stackoff":switch(s){case"left":jQuery(w).css({marginLeft:0,zIndex:81}),jQuery(w).animate({marginLeft:-l+"px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p)),jQuery(r).css({marginLeft:0,zIndex:80}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10);break;case"right":jQuery(w).css({marginLeft:0,zIndex:81}),jQuery(w).animate({marginLeft:l+"px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p)),jQuery(r).css({marginLeft:0,zIndex:80}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10);break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;case"turnover":switch(s){case"left":case"right":var d=parseInt(jQuery(r).css("width")),u=parseInt(jQuery(n).css("marginLeft"));jQuery(w).css({zIndex:80}),jQuery(r).css({zIndex:81,width:0}),jQuery(n).css({maxWidth:0,marginLeft:0}),jQuery(n).fadeIn(10),jQuery(r).animate({width:l},wppaAnimationSpeed,"swing"),jQuery(n).animate({maxWidth:d,marginLeft:u},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p)),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10);break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;default:alert("Animation type "+wppaAnimationType+" is not supported in this version")}}function _wppaNextSlide_4(p){var a=_wppaFg[p],e="#theslide"+a+"-"+p;jQuery("#theslide"+(1-a)+"-"+p).css({zIndex:80}),jQuery(e).css({zIndex:81}),_wppaCurIdx[p]=_wppaNxtIdx[p],wppaFormatSlide(p),wppaIsMini[p]||wppaGetContainerWidth(p)<wppaMiniTreshold?jQuery("#counter-"+p).html(_wppaCurIdx[p]+1+" / "+_wppaSlides[p].length):jQuery("#counter-"+p).html(wppaPhoto+" "+(_wppaCurIdx[p]+1)+" "+wppaOf+" "+_wppaSlides[p].length),jQuery("#bc-pname-modal-"+p).html(_wppaNames[p][_wppaCurIdx[p]]),jQuery("#bc-pname-"+p).html(_wppaNames[p][_wppaCurIdx[p]]),_wppaAdjustFilmstrip(p),_wppaSetRatingDisplay(p),setTimeout("_wppaNextSlide_5( "+p+" )",_wppaTextDelay)}function _wppaNextSlide_5(p){if(!_wppaToTheSame){var a=_wppaDsc[p][_wppaCurIdx[p]];if(jQuery("#imagedesc-"+p).html(a),wppaHideWhenEmpty){var e=_wppaDsc[p][_wppaCurIdx[p]];""==e||"&nbsp;"==e?jQuery("#descbox-"+p).css("display","none"):jQuery("#descbox-"+p).css("display","")}jQuery("#imagetitle-"+p).html(wppaMakeNameHtml(p)),jQuery("#wppa-comments-"+p).html(_wppaCommentHtml[p][_wppaCurIdx[p]]),jQuery("#iptc-"+p).html(_wppaIptcHtml[p][_wppaCurIdx[p]]),jQuery("#exif-"+p).html(_wppaExifHtml[p][_wppaCurIdx[p]]),jQuery("#wppa-share-"+p).html(_wppaShareHtml[p][_wppaCurIdx[p]])}if(_wppaToTheSame=!1,_wppaSSRuns[p]&&!wppaSlideWrap[p]&&_wppaCurIdx[p]+1==_wppaSlides[p].length)return _wppaIsBusy[p]=!1,void _wppaStop(p);if(_wppaShowMetaData(p,"show"),-2!=_wppaTP[p]){var t=_wppaTP[p];return _wppaTP[p]=-2,_wppaDidGoto[p]=!1,_wppaIsBusy[p]=!1,wppaIsMini[p]||_bumpViewCount(_wppaId[p][_wppaCurIdx[p]]),_wppaDoAutocol(p),void wppaStartStop(p,t)}if(wppaUpdateLightboxes(),!wppaIsMini[p]){var i=_wppaShareUrl[p][_wppaCurIdx[p]];"undefined"!=typeof wppaQRUpdate&&wppaQRUpdate(_wppaShareUrl[p][_wppaCurIdx[p]]),1<_wppaSlides[p].length&&wppaPushStateSlide(p,_wppaCurIdx[p],i)}if(_wppaSSRuns[p]&&setTimeout("_wppaNextSlide( "+p+', "auto" )',wppaGetSlideshowTimeout(p)),jQuery(document).trigger("glossaryTooltipReady"),_wppaDidGoto[p]=!1,_wppaIsBusy[p]=!1,wppaIsMini[p]||_bumpViewCount(_wppaId[p][_wppaCurIdx[p]]),_wppaDoAutocol(p),wppaStopAudio(p),wppaSlideAudioStart){var w=jQuery(".wppa-audio-"+_wppaId[p][_wppaCurIdx[p]]+"-"+p);if(0<w.length){var r=w[w.length-1];r&&(wppaAudioPlaying[p]||r.play())}}wppaProtect(),jQuery(window).trigger("resize")}function wppaFormatSlide(p){var a="theimg"+_wppaFg[p]+"-"+p,e="theslide"+_wppaFg[p]+"-"+p,t="slide_frame-"+p,i=wppaColWidth[p],w=document.getElementById(a),r=jQuery(".wppa-audio-"+p);if(w){void 0!==i&&0!=i||(i=wppaGetContainerWidth(p),wppaColWidth[p]=i);var o=w.naturalWidth;void 0===o&&(o=parseInt(w.style.maxWidth));var n=w.naturalHeight;void 0===n&&(n=parseInt(w.style.maxHeight));var l=wppaAspectRatio[p],s=wppaFullSize[p],d=wppaFullFrameDelta[p],u=wppaPortraitOnly[p],_=wppaFullValign[p];void 0===_&&(_="none");var m=wppaFullHalign[p];void 0===m&&(m="none");var c,y,h,S,x,f,g,I,j=wppaStretch;if(u)c=i-d,S=h=0,g=x=i,I=f=(y=parseInt(c*n/o))+d,jQuery("#"+t).css({width:g,height:I}),jQuery("#"+e).css({width:x,height:f}),jQuery("#"+a).css({width:c,height:y});else{if(s<(g=i)&&(g=s),x=g,f=I=parseInt(g*l),j||g-d<=o||I-d<=n?l<(n+d)/(o+d)?(y=I-d,c=parseInt(y*o/n)):(c=g-d,y=parseInt(c*n/o)):(c=o,y=n),"default"!=_&&"none"!=_){switch(_){case"top":S=0;break;case"center":S=parseInt((I-(y+d))/2);break;case"bottom":S=I-(y+d);break;case"fit":S=0,f=I=y+d}jQuery("#"+a).css({marginTop:S,marginBottom:0})}if(jQuery("#"+t).css({width:g,height:I}),jQuery("#"+e).css({width:x,height:f}),jQuery("#"+a).css({width:c,height:y}),"default"!=_&&"none"!=_&&"none"!=m&&"default"!=m){switch(m){case"left":h=0;break;case"center":h=parseInt((i-g)/2);break;case"right":h=i-g}h<0&&(h=0),jQuery("#"+a).css({marginLeft:"auto",marginRight:"auto"}),jQuery("#"+t).css({marginLeft:h})}var Q=jQuery(r).height(),b=(g-c)/2;Q&&0<Q&&(wppaAudioHeight=Q,jQuery(r).css({height:wppaAudioHeight,width:c,left:b}))}var v,N=parseInt(g/3),T=2*N;v=0<r.length?I-wppaAudioHeight-wppaSlideBorderWidth-S:I,jQuery("#bbb-"+p+"-l").css({height:v,width:N,left:0}),jQuery("#bbb-"+p+"-r").css({height:v,width:N,left:T})}}function wppaMakeNameHtml(p){var a="";if(_wppaCurIdx[p]<0)return"";if(wppaIsMini[p]||_wppaIsVideo[p][_wppaCurIdx[p]])a=_wppaFullNames[p][_wppaCurIdx[p]];else switch(wppaArtMonkyLink){case"file":case"zip":if(wppaArtMonkeyButton)if(_wppaFullNames[p][_wppaCurIdx[p]]){var e=_wppaFullNames[p][_wppaCurIdx[p]].split("<img");a='<input type="button" title="Download" style="cursor:pointer;margin-bottom:0px;max-width:'+(wppaGetContainerWidth(p)-24)+'px;" class="wppa-download-button" onclick="'+(wppaIsSafari&&"file"==wppaArtMonkyLink?"wppaWindowReference = window.open();":"")+"wppaAjaxMakeOrigName( "+p+", '"+_wppaId[p][_wppaCurIdx[p]]+'\' );" value="'+wppaDownLoad+": "+e[0]+'" />',e[1]&&(a+="<img"+e[1])}else a="";else a='<a title="Download" style="cursor:pointer;" onclick="'+(wppaIsSafari&&"file"==wppaArtMonkyLink?"wppaWindowReference = window.open();":"")+"wppaAjaxMakeOrigName( "+p+", '"+_wppaId[p][_wppaCurIdx[p]]+"' );\" >"+wppaDownLoad+": "+_wppaFullNames[p][_wppaCurIdx[p]]+"</a>";break;case"none":a=_wppaFullNames[p][_wppaCurIdx[p]];break;default:a=""}return wppaRepairBrTags(a)}function wppaMakeTheSlideHtml(p,a,e){var t,i=_wppaIsVideo[p][e]?"video":"img",w="title";"wppa"==wppaLightBox[p]&&(w="data-lbtitle");var r=""==wppaLightBox[p]?' onpause="wppaVideoPlaying['+p+'] = false;" onplay="wppaVideoPlaying['+p+'] = true;"':"";if(""!=_wppaLinkUrl[p][e])t=wppaSlideToFullpopup?'<a onclick="wppaStopAudio();wppaStopShow('+p+");"+_wppaLinkUrl[p][e]+'" target="'+_wppaLinkTarget[p][e]+'" title="'+_wppaLinkTitle[p][e]+'"><'+i+r+' title="'+_wppaLinkTitle[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e]+"</a>":"<a onclick=\"_bumpClickCount('"+_wppaId[p][e]+"');wppaStopAudio();wppaStopShow("+p+");window.open('"+_wppaLinkUrl[p][e]+"', '"+_wppaLinkTarget[p][e]+'\');" title="'+_wppaLinkTitle[p][e]+'"><'+i+r+' title="'+_wppaLinkTitle[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e]+"</a>";else if(""==wppaLightBox[p])t="<"+i+r+' title="'+_wppaNames[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e];else{for(var o="",n=0,l=wppaLightboxSingle[p]?"":"[slide-"+p+"-"+a+"]";n<e;)o+='<a href="'+(wppaOvlHires||"wppa"!=wppaLightBox[p]?_wppaHiresUrl[p][n]:wppaMakeFullsizeUrl(_wppaUrl[p][n]))+'"'+(_wppaIsVideo[p][n]?' data-videonatwidth="'+_wppaVideoNatWidth[p][n]+'" data-videonatheight="'+_wppaVideoNatHeight[p][n]+'" data-videohtml="'+encodeURI(_wppaVideoHtml[p][n])+'"':"")+(""!=_wppaAudioHtml[p][n]?' data-audiohtml="'+encodeURI(_wppaAudioHtml[p][n])+'"':"")+" "+w+'="'+_wppaLbTitle[p][n]+'" '+wppaRel+'="'+wppaLightBox[p]+l+'"></a>',n++;for(o+='<a href="'+(wppaOvlHires||"wppa"!=wppaLightBox[p]?_wppaHiresUrl[p][e]:wppaMakeFullsizeUrl(_wppaUrl[p][e]))+'" onclick="wppaStopAudio();wppaStopShow('+p+');" style="cursor:pointer;" target="'+_wppaLinkTarget[p][e]+'"'+(_wppaIsVideo[p][n]?' data-videonatwidth="'+_wppaVideoNatWidth[p][e]+'" data-videonatheight="'+_wppaVideoNatHeight[p][e]+'" data-videohtml="'+encodeURI(_wppaVideoHtml[p][e])+'"':"")+(""!=_wppaAudioHtml[p][n]?' data-audiohtml="'+encodeURI(_wppaAudioHtml[p][e])+'"':"")+" "+w+'="'+_wppaLbTitle[p][e]+'" '+wppaRel+'="'+wppaLightBox[p]+l+'"><'+i+r+' title="'+_wppaLinkTitle[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e]+"</a>",n=e+1;n<_wppaUrl[p].length;)o+='<a href="'+(wppaOvlHires||"wppa"!=wppaLightBox[p]?_wppaHiresUrl[p][n]:wppaMakeFullsizeUrl(_wppaUrl[p][n]))+'"'+(_wppaIsVideo[p][n]?' data-videonatwidth="'+_wppaVideoNatWidth[p][n]+'" data-videonatheight="'+_wppaVideoNatHeight[p][n]+'" data-videohtml="'+encodeURI(_wppaVideoHtml[p][n])+'"':"")+(""!=_wppaAudioHtml[p][n]?' data-audiohtml="'+encodeURI(_wppaAudioHtml[p][n])+'"':"")+" "+w+'="'+_wppaLbTitle[p][n]+'" '+wppaRel+'="'+wppaLightBox[p]+l+'"></a>',n++;t=o}""!=_wppaAudioHtml[p][e]&&(t+='<audio controls id="wppa-audio-'+_wppaId[p][e]+"-"+p+'" class="wppa-audio-'+p+" wppa-audio-"+_wppaId[p][e]+"-"+p+'" data-from="wppa" onplay="wppaAudioPlaying['+p+'] = true;" onpause="wppaAudioPlaying['+p+'] = false" style="position:relative;top:-'+(wppaAudioHeight+wppaSlideBorderWidth)+"px;z-index:10;width:"+_wppaVideoNatWidth[p][e]+'px;padding:0;box-sizing:border-box;" >'+_wppaAudioHtml[p][e]+"</audio>"),t=t.replace(/title=""/g,""),jQuery("#theslide"+a+"-"+p).html(t)}function _wppaAdjustFilmstrip(p){if(document.getElementById("wppa-filmstrip-"+p)){var a;if(jQuery(".wppa-film-"+p).removeClass("wppa-filmthumb-active"),_wppaFilmNoMove[p])_wppaFilmNoMove[p]=!1;else a=wppaFilmStripLength[p]/2-(_wppaCurIdx[p]+.5+wppaPreambule[p])*wppaThumbnailPitch[p]-wppaFilmStripMargin[p],wppaFilmShowGlue&&(a-=2*wppaFilmStripMargin[p]+2),jQuery("#wppa-filmstrip-"+p).stop().animate({marginLeft:a+"px"},wppaAnimationSpeed);if(-1!=_wppaCurIdx[p]){var e=_wppaCurIdx[p]-10;e<0&&(e=0);var t=_wppaCurIdx[p]+10;t>_wppaSlides[p].length&&(t=_wppaSlides[p].length);for(var i=0;i<_wppaSlides[p].length;){jQuery("#film_wppatnf_"+_wppaId[p][i]+"_"+p).html()&&(jQuery(window).trigger("scroll"),""!=jQuery("#wppa-film-"+i+"-"+p).attr("data-title")?(jQuery("#wppa-film-"+i+"-"+p).attr("title",jQuery("#wppa-film-"+i+"-"+p).attr("data-title")),jQuery("#wppa-pre-"+i+"-"+p).attr("title",jQuery("#wppa-film-"+i+"-"+p).attr("data-title"))):""!=wppaFilmThumbTitle&&_wppaCurIdx[p]==i?(jQuery("#wppa-film-"+i+"-"+p).attr("title",wppaFilmThumbTitle),jQuery("#wppa-pre-"+i+"-"+p).attr("title",wppaFilmThumbTitle)):(jQuery("#wppa-film-"+i+"-"+p).attr("title",wppaClickToView+" "+_wppaNames[p][i]),jQuery("#wppa-pre-"+i+"-"+p).attr("title",wppaClickToView+" "+_wppaNames[p][i]))),i++}}jQuery("#wppa-film-"+_wppaCurIdx[p]+"-"+p).addClass("wppa-filmthumb-active")}}function _wppaNext(p){(wppaSlideWrap[p]||_wppaCurIdx[p]!=_wppaSlides[p].length-1)&&(_wppaNxtIdx[p]=_wppaCurIdx[p]+1,_wppaNxtIdx[p]==_wppaSlides[p].length&&(_wppaNxtIdx[p]=0),_wppaNextSlide(p,0))}function _wppaNextN(p,a){if(wppaSlideWrap[p]||!(_wppaCurIdx[p]>=_wppaSlides[p].length-a)){for(_wppaNxtIdx[p]=_wppaCurIdx[p]+a;_wppaNxtIdx[p]>=_wppaSlides[p].length;)_wppaNxtIdx[p]-=_wppaSlides[p].length;_wppaNextSlide(p,0)}}function _wppaNextOnCallback(p){if(wppaSlideWrap[p]||_wppaCurIdx[p]!=_wppaSlides[p].length-1){if(_wppaSkipRated[p]){var a=_wppaCurIdx[p]+1;a==_wppaSlides[p].length&&(a=0);var e=a;if(0!=_wppaMyr[p][e]){for(++a==_wppaSlides[p].length&&(a=0);a!=e&&0!=_wppaMyr[p][a];)++a==_wppaSlides[p].length&&(a=0);e=a}_wppaNxtIdx[p]=e}else _wppaNxtIdx[p]=_wppaCurIdx[p]+1,_wppaNxtIdx[p]==_wppaSlides[p].length&&(_wppaNxtIdx[p]=0);_wppaNextSlide(p,0)}}function _wppaPrev(p){(wppaSlideWrap[p]||0!=_wppaCurIdx[p])&&(_wppaNxtIdx[p]=_wppaCurIdx[p]-1,_wppaNxtIdx[p]<0&&(_wppaNxtIdx[p]=_wppaSlides[p].length-1),_wppaNextSlide(p,0))}function _wppaPrevN(p,a){if(wppaSlideWrap[p]||!(_wppaCurIdx[p]<a)){for(_wppaNxtIdx[p]=_wppaCurIdx[p]-a;_wppaNxtIdx[p]<0;)_wppaNxtIdx[p]+=_wppaSlides[p].length;_wppaNextSlide(p,0)}}function _wppaGoto(p,a){_wppaToTheSame=_wppaNxtIdx[p]==a,_wppaNxtIdx[p]=a,_wppaNextSlide(p,0)}function _wppaGotoRunning(p,a){_wppaIsBusy[p]?setTimeout("_wppaGotoRunning( "+p+","+a+" )",10):(wppaConsoleLog("GotoRunning "+p),_wppaSSRuns[p]=!1,_wppaToTheSame=_wppaNxtIdx[p]==a,_wppaNxtIdx[p]=a,__wppaOverruleRun=!0,_wppaNextSlide(p,"manual"),_wppaGotoContinue(p))}function _wppaGotoContinue(p){_wppaIsBusy[p]?setTimeout("_wppaGotoContinue( "+p+" )",10):setTimeout("_wppaNextSlide( "+p+', "reset" )',wppaGetSlideshowTimeout(p)+10)}function _wppaStart(p,a){"icons"==wppaSlideshowNavigationType?_wppaStartIcons(p,a):_wppaStartText(p,a)}function _wppaStartIcons(p,a){if(-2==a){var e=0;if(a=0,_wppaSkipRated[p]=!0,0!=_wppaMyr[p][e])for(;e<_wppaSlides[p].length;)0==a&&0==_wppaMyr[p][e]&&(a=e),e++}var t=wppaIconSize(p,"1.5em",!1);-1<a?(jQuery("#startstop-"+p).html(wppaSvgHtml("Play-Button",t,!1,!0,"0","10","20","50")),jQuery("#speed0-"+p).hide(),jQuery("#speed1-"+p).hide(),_wppaNxtIdx[p]=a,_wppaCurIdx[p]=a,_wppaNextSlide(p,0),_wppaShowMetaData(p,"show")):(_wppaSSRuns[p]=!0,_wppaNextSlide(p,0),jQuery("#startstop-"+p).html(wppaSvgHtml("Pause-Button",t,!1,!0,"0","10","20","50")),jQuery("#speed0-"+p).show(),jQuery("#speed1-"+p).show(),_wppaShowMetaData(p,"hide"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(wppaSlideShow):jQuery("#bc-pname-"+p).html(wppaSlideShow)),_wppaSetRatingDisplay(p)}function _wppaStartText(p,a){if(-2==a){var e=0;if(a=0,_wppaSkipRated[p]=!0,0!=_wppaMyr[p][e])for(;e<_wppaSlides[p].length;)0==a&&0==_wppaMyr[p][e]&&(a=e),e++}-1<a?(jQuery("#startstop-"+p).html(wppaStart+" "+wppaSlideShow),jQuery("#speed0-"+p).css("display","none"),jQuery("#speed1-"+p).css("display","none"),_wppaNxtIdx[p]=a,_wppaCurIdx[p]=a,_wppaNextSlide(p,0),_wppaShowMetaData(p,"show")):(_wppaSSRuns[p]=!0,_wppaNextSlide(p,0),jQuery("#startstop-"+p).html(wppaStop),jQuery("#speed0-"+p).css("display","inline"),jQuery("#speed1-"+p).css("display","inline"),_wppaShowMetaData(p,"hide"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(wppaSlideShow):jQuery("#bc-pname-"+p).html(wppaSlideShow)),_wppaSetRatingDisplay(p)}function _wppaStop(p){"icons"==wppaSlideshowNavigationType?_wppaStopIcons(p):_wppaStopText(p)}function _wppaStopIcons(p){_wppaSSRuns[p]=!1,jQuery("#startstop-"+p).html(wppaSvgHtml("Play-Button",wppaIconSize(p,"1.5em",!1),!1,!0)),jQuery("#speed0-"+p).hide(),jQuery("#speed1-"+p).hide(),_wppaShowMetaData(p,"show"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(_wppaNames[p][_wppaCurIdx[p]]):jQuery("#bc-pname-"+p).html(_wppaNames[p][_wppaCurIdx[p]])}function _wppaStopText(p){_wppaSSRuns[p]=!1,jQuery("#startstop-"+p).html(wppaStart+" "+wppaSlideShow),jQuery("#speed0-"+p).css("display","none"),jQuery("#speed1-"+p).css("display","none"),_wppaShowMetaData(p,"show"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(_wppaNames[p][_wppaCurIdx[p]]):jQuery("#bc-pname-"+p).html(_wppaNames[p][_wppaCurIdx[p]])}function _wppaSpeed(p,a){"random"!=_wppaTimeOut[p]&&(a?500<_wppaTimeOut[p]&&(_wppaTimeOut[p]/=1.5):_wppaTimeOut[p]<6e4&&(_wppaTimeOut[p]*=1.5))}function _wppaLoadSpinner(p){}function _wppaUnloadSpinner(p){jQuery("#wppa-slide-spin-"+p).stop().fadeOut(),setTimeout(function(){jQuery("#wppa-slide-spin-"+p).stop().fadeOut()},1e3)}function _wppaCheckRewind(p){var a,e,t;document.getElementById("wppa-filmstrip-"+p)&&((a=Math.abs(_wppaCurIdx[p]-_wppaNxtIdx[p]))<=wppaFilmPageSize[p]||(wppaFilmStripLength[p]/wppaThumbnailPitch[p]+1)/2<=a&&(e=wppaThumbnailPitch[p]*_wppaSlides[p].length,wppaFilmShowGlue&&(e+=2+2*wppaFilmStripMargin[p]),t=parseInt(jQuery("#wppa-filmstrip-"+p).css("margin-left")),_wppaNxtIdx[p]>_wppaCurIdx[p]?t-=e:t+=e,jQuery("#wppa-filmstrip-"+p).css("margin-left",t+"px")))}function _wppaSetRatingDisplay(p){var a,e,t,w,r;if(document.getElementById("wppa-rating-"+p)&&void 0!==(a=_wppaAvg[p][_wppaCurIdx[p]])){if("likes"==wppaRatingDisplayType){var o=a.split("|");return jQuery("#wppa-like-"+p).attr("title",o[0]),jQuery("#wppa-liketext-"+p).html(o[1]),void("1"==_wppaMyr[p][_wppaCurIdx[p]]?jQuery("#wppa-like-"+p).attr("src",wppaImageDirectory+"thumbdown.png"):jQuery("#wppa-like-"+p).attr("src",wppaImageDirectory+"thumbup.png"))}if(a=(e=a.split("|"))[0],t=e[1],w=_wppaDisc[p][_wppaCurIdx[p]],r=_wppaMyr[p][_wppaCurIdx[p]],"graphic"==wppaRatingDisplayType)_wppaSetRd(p,a,"#wppa-avg-"),_wppaSetRd(p,r,"#wppa-rate-"),0==r?(jQuery("#wppa-dislike-"+p).css("display","inline"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","inline"),document.getElementById("wppa-dislike-"+p)&&jQuery("#wppa-filler-"+p).css("display","none"),jQuery("#wppa-dislike-"+p).stop().fadeTo(100,wppaStarOpacity)):(jQuery("#wppa-dislike-"+p).css("display","none"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","none"),jQuery("#wppa-filler-"+p).css("display","inline"),jQuery("#wppa-filler-"+p).stop().fadeTo(100,wppaStarOpacity),jQuery("#wppa-filler-"+p).attr("title",w));else{if(jQuery("#wppa-numrate-avg-"+p).html(a+" ( "+t+" ) "),wppaRatingOnce&&0<r)jQuery("#wppa-numrate-mine-"+p).html(r);else if(r<0)jQuery("#wppa-numrate-mine-"+p).html(" dislike");else{var n="";for(i=1;i<=wppaRatingMax;i++)r==i?n+='<span style="cursor:pointer; font-weight:bold;" onclick="_wppaRateIt( '+p+", "+i+' )">&nbsp;'+i+"&nbsp;</span>":(r>i-1&&r<i&&(n+="&nbsp;( "+r+" )&nbsp;"),n+='<span style="cursor:pointer;" onclick="_wppaRateIt( '+p+", "+i+' )" onmouseover="this.style.fontWeight=\'bold\'" onmouseout="this.style.fontWeight=\'normal\'" >&nbsp;'+i+"&nbsp;</span>");jQuery("#wppa-numrate-mine-"+p).html(n)}0==r?(jQuery("#wppa-dislike-"+p).css("display","inline"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","inline"),jQuery("#wppa-filler-"+p).css("display","none"),jQuery("#wppa-dislike-"+p).stop().fadeTo(100,wppaStarOpacity)):(jQuery("#wppa-dislike-"+p).css("display","none"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","none"),jQuery("#wppa-filler-"+p).css("display","inline")),jQuery("#wppa-discount-"+p).html(w+"&bull; "),jQuery("#wppa-filler-"+p).css("display","none")}0==r?jQuery("#wppa-vote-button-"+p).val(wppaVoteForMe):jQuery("#wppa-vote-button-"+p).val(wppaVotedForMe),jQuery("#wppa-vote-count-"+p).html(t)}}function wppaGetDislikeText(p,a,e){return p}function _wppaSetRd(p,a,e){var t=parseInt(a),i=t+1,w=wppaStarOpacity+(a-t)*(1-wppaStarOpacity),r=wppaRatingMax;for(idx=1;idx<=r;idx++)"#wppa-rate-"!=e&&".wppa-rate-"!=e||jQuery(e+p+"-"+idx).attr("src")!=wppaImageDirectory+"star.ico"&&jQuery(e+p+"-"+idx).attr("src",wppaImageDirectory+"star.ico"),idx<=t?jQuery(e+p+"-"+idx).stop().fadeTo(100,1):idx==i?jQuery(e+p+"-"+idx).stop().fadeTo(100,w):jQuery(e+p+"-"+idx).stop().fadeTo(100,wppaStarOpacity)}function _wppaFollowMe(p,a){_wppaSSRuns[p]||0!=_wppaMyr[p][_wppaCurIdx[p]]&&wppaRatingOnce||_wppaMyr[p][_wppaCurIdx[p]]<0||_wppaVoteInProgress||_wppaSetRd(p,a,"#wppa-rate-")}function wppaOvlFollowMe(p,a,e){e||_wppaSetRd(p,a,".wppa-rate-")}function _wppaLeaveMe(p,a){_wppaSSRuns[p]||0!=_wppaMyr[p][_wppaCurIdx[p]]&&wppaRatingOnce||_wppaMyr[p][_wppaCurIdx[p]]<0||_wppaVoteInProgress||_wppaSetRd(p,_wppaMyr[p][_wppaCurIdx[p]],"#wppa-rate-")}function wppaOvlLeaveMe(p,a,e){_wppaSetRd(p,e,".wppa-rate-")}function _wppaValidateComment(p,a){if(a||(a=_wppaId[p][_wppaCurIdx[p]]),jQuery("#wppa-comname-"+p).val().length<1)return alert(wppaPleaseName),!1;if("required"==wppaEmailRequired||"optional"==wppaEmailRequired){var e=jQuery("#wppa-comemail-"+p).val();if("optional"==wppaEmailRequired&&0==e.length)return!0;var t=e.indexOf("@"),i=e.lastIndexOf(".");if(t<1||i<t+2||i+2>=e.length)return alert(wppaPleaseEmail),!1}return!(jQuery("#wppa-comment-"+p).val().length<1)||(alert(wppaPleaseComment),!1)}function _wppaGo(p){document.location=p}function _wppaBbb(p,a,e){if(!_wppaSSRuns[p]){var t="#bbb-"+p+"-"+a;switch(e){case"show":"l"==a&&jQuery(t).attr("title",wppaPreviousPhoto),"r"==a&&jQuery(t).attr("title",wppaNextPhoto),jQuery(".bbb-"+p).css("cursor","pointer");break;case"hide":jQuery(".bbb-"+p).removeAttr("title"),jQuery(".bbb-"+p).css("cursor","default");break;case"click":"l"==a&&wppaPrev(p),"r"==a&&wppaNext(p);break;default:alert("Unimplemented instruction: "+e+" on: "+t)}}}function _wppaUbb(p,a,e){var t="#ubb-"+p+"-"+a;switch(e){case"show":"l"==a&&jQuery(t).attr("title",wppaPreviousPhoto),"r"==a&&jQuery(t).attr("title",wppaNextPhoto),jQuery(".ubb-"+p).css("cursor","pointer"),jQuery(".ubb-"+p).stop().fadeTo(200,.8),jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(200,.8);break;case"hide":jQuery(".ubb-"+p).removeAttr("title"),jQuery(".ubb-"+p).css("cursor","default"),jQuery(".ubb-"+p).stop().fadeTo(200,0),jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(200,0);break;case"click":var i;if("l"==a&&(i=_wppaCurIdx[p]-1)<0){if(!wppaSlideWrap[p])return;i=_wppaSlides[p].length-1}if("r"==a&&(i=_wppaCurIdx[p]+1)==_wppaSlides[p].length){if(!wppaSlideWrap[p])return;i=0}wppaIsMobile&&(jQuery(".ubb-"+p).stop().fadeTo(200,1).fadeTo(1e3,0),jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(200,1).fadeTo(1e3,0)),wppaGotoKeepState(p,i);break;default:alert("Unimplemented instruction: "+e+" on: "+t)}}function wppaOpenComments(p){_wppaSSRuns[p]&&_wppaStop(p),jQuery("#wppa-comtable-wrap-"+p).css("display","block"),jQuery("#wppa-comform-wrap-"+p).css("display","block"),jQuery("#wppa-comfooter-wrap-"+p).css("display","none"),wppaColWidth[p]=0,setTimeout("_wppaDoAutocol( "+p+" )",100)}function _wppaShowMetaData(p,a){_wppaSSRuns[p]||__wppaOverruleRun?"show"==a?wppaFotomotoHideWhenRunning||wppaFotomotoToolbar(p,_wppaHiresUrl[p][_wppaCurIdx[p]]):wppaShareHideWhenRunning&&jQuery("#wppa-share-"+p).css("display","none"):"show"==a?(wppaAutoOpenComments&&(jQuery("#wppa-comtable-wrap-"+p).css("display","block"),jQuery("#wppa-comform-wrap-"+p).css("display","block"),jQuery("#wppa-comfooter-wrap-"+p).css("display","none")),0!=_wppaCurIdx[p]&&jQuery(".wppa-first-"+p).show(),_wppaCurIdx[p]!=_wppaSlides[p].length-1&&jQuery(".wppa-last-"+p).show(),wppaShareHideWhenRunning&&jQuery("#wppa-share-"+p).css("display",""),wppaFotomotoToolbar(p,_wppaHiresUrl[p][_wppaCurIdx[p]])):(jQuery("#wppa-comtable-wrap-"+p).css("display","none"),jQuery("#wppa-comform-wrap-"+p).css("display","none"),jQuery("#wppa-comfooter-wrap-"+p).css("display","block"),wppaFotomotoHide(p)),"show"==a?(jQuery("#imagedesc-"+p).css("visibility","visible"),jQuery("#imagetitle-"+p).css("visibility","visible"),jQuery("#counter-"+p).css("visibility","visible"),jQuery("#iptccontent-"+p).css("visibility","visible"),jQuery("#exifcontent-"+p).css("visibility","visible")):(jQuery("#counter-"+p).css("visibility","hidden"),jQuery(".wppa-first-"+p).hide(),jQuery(".wppa-last-"+p).hide(),jQuery("#iptccontent-"+p).css("visibility","hidden"),jQuery("#exifcontent-"+p).css("visibility","hidden"))}function wppaGetSlideshowTimeout(p){var a;if("random"==_wppaTimeOut[p]){var e=2*wppaAnimationSpeed,t=7*wppaAnimationSpeed;a=Math.floor(Math.random()*(t-e+1))+e}else a=_wppaTimeOut[p];return a}wppaConsoleLog("wppa-slideshow.js version "+wppaJsSlideshowVersion+" loaded.","force");
1
+ var wppaJsSlideshowVersion="6.9.20";function wppaStoreSlideInfo(p,a,e,t,i,w,r,o,n,s,l,d,u,_,m,c,y,h,S,x,f,g,j,I,Q,b,v,N,T,C,k){var R,L;(n=wppaRepairScriptTags(n),_wppaSlides[p]&&"0"!=a||(_wppaSlides[p]=[],_wppaNames[p]=[],_wppaFullNames[p]=[],_wppaDsc[p]=[],_wppaOgDsc[p]=[],_wppaCurIdx[p]=-1,_wppaNxtIdx[p]=0,"random"==h?_wppaTimeOut[p]="random":0<parseInt(h)?_wppaTimeOut[p]=parseInt(h):_wppaTimeOut[p]=wppaSlideShowTimeOut,_wppaSSRuns[p]=!1,_wppaTP[p]=-2,_wppaFg[p]=0,_wppaIsBusy[p]=!1,_wppaFirst[p]=!0,_wppaId[p]=[],_wppaAvg[p]=[],_wppaDisc[p]=[],_wppaMyr[p]=[],_wppaVRU[p]=[],_wppaLinkUrl[p]=[],_wppaLinkTitle[p]=[],_wppaLinkTarget[p]=[],_wppaCommentHtml[p]=[],_wppaIptcHtml[p]=[],_wppaExifHtml[p]=[],_wppaUrl[p]=[],_wppaSkipRated[p]=!1,_wppaLbTitle[p]=[],_wppaDidGoto[p]=!1,wppaSlidePause[p]=!1,_wppaShareUrl[p]=[],_wppaShareHtml[p]=[],_wppaFilmNoMove[p]=!1,_wppaHiresUrl[p]=[],_wppaIsVideo[p]=[],_wppaVideoHtml[p]=[],_wppaAudioHtml[p]=[],_wppaVideoNatWidth[p]=[],_wppaVideoNatHeight[p]=[],wppaVideoPlaying[p]=!1,wppaAudioPlaying[p]=!1,_wppaWaitTexts[p]=[],_wppaImageAlt[p]=[]),R="default",""!=m?R="pointer":""!=wppaLightBox[p]&&(R="url( "+wppaImageDirectory+wppaMagnifierCursor+" ),pointer"),_wppaIsVideo[p][a]=""!=v,_wppaIsVideo[p][a]?(_wppaSlides[p][a]=' alt="'+C+'" class="theimg theimg-'+p+' big" ',wppaSlideVideoStart&&""==wppaLightBox[p]&&(_wppaSlides[p][a]+=" autoplay "),0<k.length&&(_wppaSlides[p][a]+=' poster="'+k+'" ')):_wppaSlides[p][a]=' src="'+e+'" alt="'+C+'" class="theimg theimg-'+p+' big stereo" ',wppaSlideSwipe&&(_wppaSlides[p][a]+=' ontouchstart="wppaTouchStart( event, this.id, '+p+' );" ontouchend="wppaTouchEnd( event );" ontouchmove="wppaTouchMove( event );" ontouchcancel="wppaTouchCancel( event );" '),wppaAutoColumnWidth[p]||(_wppaSlides[p][a]+='width="'+i+'" height="'+w+'" '),_wppaIsVideo[p][a])?(L="wppa"==wppaLightBox[p]?"":"controls",_wppaSlides[p][a]+='style="'+t+"; cursor:"+R+'; display:none;" '+L+">"+v+"</video>"):_wppaSlides[p][a]+='style="'+t+"; cursor:"+R+'; display:none; vertical-align:middle;">';_wppaFullNames[p][a]=wppaRepairBrTags(r),_wppaNames[p][a]=o,_wppaDsc[p][a]=n,_wppaOgDsc[p][a]=Q,_wppaId[p][a]=s,_wppaAvg[p][a]=l,_wppaDisc[p][a]=d,_wppaMyr[p][a]=u,_wppaVRU[p][a]=_,_wppaLinkUrl[p][a]=m,_wppaLinkTitle[p][a]=c,""!=y?_wppaLinkTarget[p][a]=y:wppaSlideBlank[p]?_wppaLinkTarget[p][a]="_blank":_wppaLinkTarget[p][a]="_self",_wppaCommentHtml[p][a]=S,_wppaIptcHtml[p][a]=x,_wppaExifHtml[p][a]=f,_wppaUrl[p][a]=e,_wppaLbTitle[p][a]=wppaRepairScriptTags(g),_wppaShareUrl[p][a]=j,_wppaShareHtml[p][a]=wppaRepairScriptTags(I),_wppaHiresUrl[p][a]=b,_wppaVideoHtml[p][a]=v,_wppaAudioHtml[p][a]=N,_wppaVideoNatWidth[p][a]=i,_wppaVideoNatHeight[p][a]=w,_wppaWaitTexts[p][a]=T,_wppaImageAlt[p][a]=C}function wppaSpeed(p,a){_wppaSSRuns[p]&&_wppaSpeed(p,a)}function wppaStopShow(p){_wppaSSRuns[p]&&_wppaStop(p)}function wppaStartStop(p,a){_wppaIsBusy[p]?_wppaTP[p]=a:(_wppaSSRuns[p]?(_wppaStop(p),jQuery("#wppa-startstop-icon-"+p).html(wppaSvgHtml("Play-Button",wppaIconSize(p,"48px",!0),!1,!0,"0","10","50","50"))):(_wppaStart(p,a),-1==a&&jQuery("#wppa-startstop-icon-"+p).html(wppaSvgHtml("Pause-Button",wppaIconSize(p,"48px",!0),!1,!0,"0","10","50","50"))),wppaIsMobile&&(jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(10,1).fadeTo(3e3,0),jQuery(".ubb-"+p).stop().fadeTo(10,1).fadeTo(3e3,0)))}function wppaBbb(p,a,e){_wppaSSRuns[p]||_wppaBbb(p,a,e)}function wppaUbb(p,a,e){_wppaUbb(p,a,e)}function wppaRateIt(p,a){_wppaRateIt(p,a)}function wppaOvlRateIt(p,a,e,t){_wppaOvlRateIt(p,a,e,t)}function wppaPrev(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaPrev(p)}function wppaPrevN(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaPrevN(p,a)}function wppaFirst(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaGoto(p,0)}function wppaNext(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaNext(p)}function wppaNextN(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaNextN(p,a)}function wppaLast(p){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaGoto(p,_wppaSlides[p].length-1)}function wppaFollowMe(p,a){_wppaSSRuns[p]||_wppaFollowMe(p,a)}function wppaLeaveMe(p,a){_wppaSSRuns[p]||_wppaLeaveMe(p,a)}function wppaGoto(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||_wppaGoto(p,a)}function wppaGotoFilmNoMove(p,a){_wppaDidGoto[p]=!0,_wppaSSRuns[p]||(_wppaFilmNoMove[p]=!0,_wppaGoto(p,a))}function wppaGotoKeepState(p,a){_wppaNxtIdx[p]!=a&&(_wppaDidGoto[p]=!0,_wppaGotoKeepState(p,a))}function _wppaGotoKeepState(p,a){_wppaSSRuns[p]?_wppaGotoRunning(p,a):_wppaGoto(p,a)}function wppaGotoRunning(p,a){_wppaDidGoto[p]=!0,_wppaGotoRunning(p,a)}function wppaValidateComment(p){return _wppaValidateComment(p)}function _wppaNextSlide(p,a){var e=_wppaFg[p],t=1-e;if((wppaVideoPlaying[p]||wppaAudioPlaying[p])&&_wppaSSRuns[p])setTimeout("_wppaNextSlide( "+p+", '"+a+"' )",500);else{if(wppaStopVideo(p),wppaStopAudio(p),"auto"==a){if(wppaSlidePause[p])return jQuery("#theimg"+e+"-"+p).attr("title",wppaSlidePause[p]),jQuery("#slide_frame-"+p).attr("title",wppaSlidePause[p]),void setTimeout("_wppaNextSlide( "+p+', "auto" )',250)}else jQuery("#slide_frame-"+p).removeAttr("title");if((_wppaSSRuns[p]||"auto"!=a)&&_wppaSlides[p]&&(!(_wppaSlides[p].length<2)||_wppaFirst[p])){if(_wppaSSRuns[p]||"reset"!=a||(_wppaSSRuns[p]=!0,__wppaOverruleRun=!1),_wppaVoteInProgress=!1,_wppaIsBusy[p]=!0,_wppaSSRuns[p]&&_wppaShowMetaData(p,"hide"),_wppaSSRuns[p]&&(_wppaNxtIdx[p]=_wppaCurIdx[p]+1,_wppaNxtIdx[p]==_wppaSlides[p].length&&(_wppaNxtIdx[p]=0)),jQuery("#geodiv-"+p+"-"+_wppaId[p][_wppaCurIdx[p]]).css({display:"none"}),jQuery("#geodiv-"+p+"-"+_wppaId[p][_wppaNxtIdx[p]]).css({display:""}),"undefined"!=typeof _wppaLat&&_wppaLat[p]&&_wppaLat[p][_wppaId[p][_wppaNxtIdx[p]]]?(jQuery("#map-canvas-"+p).css("display",""),wppaGeoInit(p,_wppaLat[p][_wppaId[p][_wppaNxtIdx[p]]],_wppaLon[p][_wppaId[p][_wppaNxtIdx[p]]])):jQuery("#map-canvas-"+p).css("display","none"),jQuery("[id^=wppa-numbar-"+p+"-]").css({backgroundColor:wppaBGcolorNumbar,borderColor:wppaBcolorNumbar,fontFamily:wppaFontFamilyNumbar,fontSize:wppaFontSizeNumbar,color:wppaFontColorNumbar,fontWeight:wppaFontWeightNumbar}),jQuery("#wppa-numbar-"+p+"-"+_wppaNxtIdx[p]).css({backgroundColor:wppaBGcolorNumbarActive,borderColor:wppaBcolorNumbarActive,fontFamily:wppaFontFamilyNumbarActive,fontSize:wppaFontSizeNumbarActive,color:wppaFontColorNumbarActive,fontWeight:wppaFontWeightNumbarActive}),_wppaSlides[p].length>wppaNumbarMax){var i,w,r=_wppaSlides[p].length-1,o=_wppaNxtIdx[p],n=(wppaNumbarMax-1)/2;o<n?(i=0,w=wppaNumbarMax-1-1,jQuery("#wppa-nbar-"+p+"-lodots").css({display:"none"}),jQuery("#wppa-nbar-"+p+"-hidots").css({display:"block"})):r-n<o?(i=(w=r)-wppaNumbarMax+1+1,jQuery("#wppa-nbar-"+p+"-lodots").css({display:"block"}),jQuery("#wppa-nbar-"+p+"-hidots").css({display:"none"})):(w=o+n+.5-1,(i=o-n+1)<2?(jQuery("#wppa-nbar-"+p+"-lodots").css({display:"none"}),jQuery("#wppa-nbar-"+p+"-hidots").css({display:"block"})):r-1<w?(jQuery("#wppa-nbar-"+p+"-lodots").css({display:"block"}),jQuery("#wppa-nbar-"+p+"-hidots").css({display:"none"})):(jQuery("#wppa-nbar-"+p+"-lodots").css({display:"block"}),jQuery("#wppa-nbar-"+p+"-hidots").css({display:"block"})));for(var s=0;s<_wppaSlides[p].length;)0!=s&&s!=r&&(s<i||w<s)?jQuery("#wppa-numbar-"+p+"-"+s).css({display:"none"}):jQuery("#wppa-numbar-"+p+"-"+s).css({display:"block"}),s++}if(_wppaFirst[p]){if(-1!=_wppaCurIdx[p]&&wppaMakeTheSlideHtml(p,"0",_wppaCurIdx[p]),wppaMakeTheSlideHtml(p,"1",_wppaNxtIdx[p]),jQuery("#imagedesc-"+p).html(_wppaDsc[p][_wppaCurIdx[p]]),jQuery("#imagetitle-"+p).html(wppaMakeNameHtml(p)),jQuery("#wppa-comments-"+p).html(_wppaCommentHtml[p][_wppaCurIdx[p]]),jQuery("#iptc-"+p).html(_wppaIptcHtml[p][_wppaCurIdx[p]]),jQuery("#exif-"+p).html(_wppaExifHtml[p][_wppaCurIdx[p]]),"icons"==wppaSlideshowNavigationType){var l=wppaIconSize(p,"1.5em",!1);jQuery("#prev-arrow-"+p).html(wppaSvgHtml("Prev-Button",l,!1,!0)),jQuery("#next-arrow-"+p).html(wppaSvgHtml("Next-Button",l,!1,!0))}else wppaIsMini[p]||wppaGetContainerWidth(p)<wppaMiniTreshold?(jQuery("#prev-arrow-"+p).html("&laquo;&nbsp;"+wppaPrevP),jQuery("#next-arrow-"+p).html(wppaNextP+"&nbsp;&raquo;")):(jQuery("#prev-arrow-"+p).html("&laquo;&nbsp;"+wppaPreviousPhoto),jQuery("#next-arrow-"+p).html(wppaNextPhoto+"&nbsp;&raquo;"));wppaIsMini[p]||wppaGetContainerWidth(p)<wppaMiniTreshold?(jQuery("#wppa-avg-rat-"+p).html(wppaAvgRat),jQuery("#wppa-my-rat-"+p).html(wppaMyRat)):(jQuery("#wppa-avg-rat-"+p).html(wppaAvgRating),jQuery("#wppa-my-rat-"+p).html(wppaMyRating))}else wppaMakeTheSlideHtml(p,t,_wppaNxtIdx[p]);_wppaLoadSpinner(p),_wppaFirst[p]=!1,_wppaCheckRewind(p),wppaColWidth[p]=0,_wppaDoAutocol(p),setTimeout("_wppaNextSlide_2( "+p+" )",10)}}}function _wppaNextSlide_2(p){var a=_wppaFg[p],e=1-a,t=document.getElementById("theimg"+e+"-"+p);if(t&&1==t.nodeType&&"IMG"==t.nodeName&&!t.complete)return setTimeout("_wppaNextSlide_2( "+p+" )",200),void wppaConsoleLog("Retry next2");wppaUpdateLightboxes(),_wppaUnloadSpinner(p),-1!=_wppaSSRuns[p]&&(_wppaToTheSame||_wppaShowMetaData(p,"hide")),_wppaFg[p]=1-_wppaFg[p],e=1-(a=_wppaFg[p]),setTimeout("_wppaNextSlide_3( "+p+" )",10)}function _wppaNextSlide_3(p){var a=_wppaFg[p],e=1-a,t=_wppaCurIdx[p],i=_wppaNxtIdx[p],w="#theslide"+e+"-"+p,r="#theslide"+a+"-"+p,o="#theimg"+e+"-"+p,n="#theimg"+a+"-"+p,s=parseInt(jQuery(w).css("width")),l="nil";switch(t==i&&(l="none"),t==i-1&&(l="left"),t==i+1&&(l="right"),t==_wppaSlides[p].length-1&&0==i&&wppaSlideWrap[p]&&(l="left"),0==t&&i==_wppaSlides[p].length-1&&wppaSlideWrap[p]&&(l="right"),"nil"==l&&(l=t<i?"left":"right"),jQuery(w).css({marginLeft:0,width:s}),jQuery(r).css({marginLeft:0,width:s}),wppaFormatSlide(p),wppaAnimationType){case"fadeover":jQuery(o).fadeOut(wppaAnimationSpeed),jQuery(n).fadeIn(wppaAnimationSpeed,_wppaNextSlide_4(p));break;case"fadeafter":jQuery(o).fadeOut(wppaAnimationSpeed),jQuery(n).delay(wppaAnimationSpeed).fadeIn(wppaAnimationSpeed,_wppaNextSlide_4(p));break;case"swipe":switch(l){case"left":jQuery(w).animate({marginLeft:-s+"px"},wppaAnimationSpeed,"swing"),jQuery(r).css({marginLeft:s+"px"}),jQuery(n).fadeIn(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"right":jQuery(w).animate({marginLeft:s+"px"},wppaAnimationSpeed,"swing"),jQuery(r).css({marginLeft:-s+"px"}),jQuery(n).fadeIn(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;case"stackon":switch(l){case"left":jQuery(w).css({zIndex:80}),jQuery(r).css({marginLeft:s+"px",zIndex:81}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"right":jQuery(w).css({zIndex:80}),jQuery(r).css({marginLeft:-s+"px",zIndex:81}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10),jQuery(r).animate({marginLeft:"0px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p));break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;case"stackoff":switch(l){case"left":jQuery(w).css({marginLeft:0,zIndex:81}),jQuery(w).animate({marginLeft:-s+"px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p)),jQuery(r).css({marginLeft:0,zIndex:80}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10);break;case"right":jQuery(w).css({marginLeft:0,zIndex:81}),jQuery(w).animate({marginLeft:s+"px"},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p)),jQuery(r).css({marginLeft:0,zIndex:80}),jQuery(n).fadeIn(10),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10);break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;case"turnover":switch(l){case"left":case"right":var d=parseInt(jQuery(r).css("width")),u=parseInt(jQuery(n).css("marginLeft"));jQuery(w).css({zIndex:80}),jQuery(r).css({zIndex:81,width:0}),jQuery(n).css({maxWidth:0,marginLeft:0}),jQuery(n).fadeIn(10),jQuery(r).animate({width:s},wppaAnimationSpeed,"swing"),jQuery(n).animate({maxWidth:d,marginLeft:u},wppaAnimationSpeed,"swing",_wppaNextSlide_4(p)),jQuery(o).delay(wppaAnimationSpeed).fadeOut(10);break;case"none":jQuery(n).fadeIn(10),setTimeout("_wppaNextSlide_4( "+p+" )",10)}break;default:alert("Animation type "+wppaAnimationType+" is not supported in this version")}}function _wppaNextSlide_4(p){var a=_wppaFg[p],e="#theslide"+a+"-"+p;jQuery("#theslide"+(1-a)+"-"+p).css({zIndex:80}),jQuery(e).css({zIndex:81}),_wppaCurIdx[p]=_wppaNxtIdx[p],wppaFormatSlide(p),wppaIsMini[p]||wppaGetContainerWidth(p)<wppaMiniTreshold?jQuery("#counter-"+p).html(_wppaCurIdx[p]+1+" / "+_wppaSlides[p].length):jQuery("#counter-"+p).html(wppaPhoto+" "+(_wppaCurIdx[p]+1)+" "+wppaOf+" "+_wppaSlides[p].length),jQuery("#bc-pname-modal-"+p).html(_wppaNames[p][_wppaCurIdx[p]]),jQuery("#bc-pname-"+p).html(_wppaNames[p][_wppaCurIdx[p]]),_wppaAdjustFilmstrip(p),_wppaSetRatingDisplay(p),setTimeout("_wppaNextSlide_5( "+p+" )",_wppaTextDelay)}function _wppaNextSlide_5(p){if(!_wppaToTheSame){var a=_wppaDsc[p][_wppaCurIdx[p]];if(jQuery("#imagedesc-"+p).html(a),wppaHideWhenEmpty){var e=_wppaDsc[p][_wppaCurIdx[p]];""==e||"&nbsp;"==e?jQuery("#descbox-"+p).css("display","none"):jQuery("#descbox-"+p).css("display","")}jQuery("#imagetitle-"+p).html(wppaMakeNameHtml(p)),jQuery("#wppa-comments-"+p).html(_wppaCommentHtml[p][_wppaCurIdx[p]]),jQuery("#iptc-"+p).html(_wppaIptcHtml[p][_wppaCurIdx[p]]),jQuery("#exif-"+p).html(_wppaExifHtml[p][_wppaCurIdx[p]]),jQuery("#wppa-share-"+p).html(_wppaShareHtml[p][_wppaCurIdx[p]])}if(_wppaToTheSame=!1,_wppaSSRuns[p]&&!wppaSlideWrap[p]&&_wppaCurIdx[p]+1==_wppaSlides[p].length)return _wppaIsBusy[p]=!1,void _wppaStop(p);if(_wppaShowMetaData(p,"show"),-2!=_wppaTP[p]){var t=_wppaTP[p];return _wppaTP[p]=-2,_wppaDidGoto[p]=!1,_wppaIsBusy[p]=!1,wppaIsMini[p]||_bumpViewCount(_wppaId[p][_wppaCurIdx[p]]),_wppaDoAutocol(p),void wppaStartStop(p,t)}if(wppaUpdateLightboxes(),!wppaIsMini[p]){var i=_wppaShareUrl[p][_wppaCurIdx[p]];"undefined"!=typeof wppaQRUpdate&&wppaQRUpdate(_wppaShareUrl[p][_wppaCurIdx[p]]),1<_wppaSlides[p].length&&wppaPushStateSlide(p,_wppaCurIdx[p],i)}if(_wppaSSRuns[p]&&setTimeout("_wppaNextSlide( "+p+', "auto" )',wppaGetSlideshowTimeout(p)),jQuery(document).trigger("glossaryTooltipReady"),_wppaDidGoto[p]=!1,_wppaIsBusy[p]=!1,wppaIsMini[p]||_bumpViewCount(_wppaId[p][_wppaCurIdx[p]]),_wppaDoAutocol(p),wppaStopAudio(p),wppaSlideAudioStart){var w=jQuery(".wppa-audio-"+_wppaId[p][_wppaCurIdx[p]]+"-"+p);if(0<w.length){var r=w[w.length-1];r&&(wppaAudioPlaying[p]||r.play())}}wppaProtect(),jQuery(window).trigger("resize")}function wppaFormatSlide(p){var a="theimg"+_wppaFg[p]+"-"+p,e="theslide"+_wppaFg[p]+"-"+p,t="slide_frame-"+p,i=wppaColWidth[p],w=document.getElementById(a),r=jQuery(".wppa-audio-"+p);if(w){void 0!==i&&0!=i||(i=wppaGetContainerWidth(p),wppaColWidth[p]=i);var o=w.naturalWidth;void 0===o&&(o=parseInt(w.style.maxWidth));var n=w.naturalHeight;void 0===n&&(n=parseInt(w.style.maxHeight));var s=wppaAspectRatio[p],l=wppaFullSize[p],d=wppaFullFrameDelta[p],u=wppaPortraitOnly[p],_=wppaFullValign[p];void 0===_&&(_="none");var m=wppaFullHalign[p];void 0===m&&(m="none");var c,y,h,S,x,f,g,j,I=wppaStretch;if(u)c=i-d,S=h=0,g=x=i,j=f=(y=parseInt(c*n/o))+d,jQuery("#"+t).css({width:g,height:j}),jQuery("#"+e).css({width:x,height:f}),jQuery("#"+a).css({width:c,height:y});else{if(l<(g=i)&&(g=l),x=g,f=j=parseInt(g*s),I||g-d<=o||j-d<=n?s<(n+d)/(o+d)?(y=j-d,c=parseInt(y*o/n)):(c=g-d,y=parseInt(c*n/o)):(c=o,y=n),"default"!=_&&"none"!=_){switch(_){case"top":S=0;break;case"center":S=parseInt((j-(y+d))/2);break;case"bottom":S=j-(y+d);break;case"fit":S=0,f=j=y+d}jQuery("#"+a).css({marginTop:S,marginBottom:0})}if(jQuery("#"+t).css({width:g,height:j}),jQuery("#"+e).css({width:x,height:f}),jQuery("#"+a).css({width:c,height:y}),"default"!=_&&"none"!=_&&"none"!=m&&"default"!=m){switch(m){case"left":h=0;break;case"center":h=parseInt((i-g)/2);break;case"right":h=i-g}h<0&&(h=0),jQuery("#"+a).css({marginLeft:"auto",marginRight:"auto"}),jQuery("#"+t).css({marginLeft:h})}var Q=jQuery(r).height(),b=(g-c)/2;Q&&0<Q&&(wppaAudioHeight=Q,jQuery(r).css({height:wppaAudioHeight,width:c,left:b}))}var v,N=parseInt(g/3),T=2*N;v=0<r.length?j-wppaAudioHeight-wppaSlideBorderWidth-S:j,jQuery("#bbb-"+p+"-l").css({height:v,width:N,left:0}),jQuery("#bbb-"+p+"-r").css({height:v,width:N,left:T})}}function wppaMakeNameHtml(p){var a="";if(_wppaCurIdx[p]<0)return"";if(wppaIsMini[p]||_wppaIsVideo[p][_wppaCurIdx[p]])a=_wppaFullNames[p][_wppaCurIdx[p]];else switch(wppaArtMonkyLink){case"file":case"zip":if(wppaArtMonkeyButton)if(_wppaFullNames[p][_wppaCurIdx[p]]){var e=_wppaFullNames[p][_wppaCurIdx[p]].split("<img");a='<input type="button" title="Download" style="cursor:pointer;margin-bottom:0px;max-width:'+(wppaGetContainerWidth(p)-24)+'px;" class="wppa-download-button" onclick="'+(wppaIsSafari&&"file"==wppaArtMonkyLink?"wppaWindowReference = window.open();":"")+"wppaAjaxMakeOrigName( "+p+", '"+_wppaId[p][_wppaCurIdx[p]]+'\' );" value="'+wppaDownLoad+": "+e[0]+'" />',e[1]&&(a+="<img"+e[1])}else a="";else a='<a title="Download" style="cursor:pointer;" onclick="'+(wppaIsSafari&&"file"==wppaArtMonkyLink?"wppaWindowReference = window.open();":"")+"wppaAjaxMakeOrigName( "+p+", '"+_wppaId[p][_wppaCurIdx[p]]+"' );\" >"+wppaDownLoad+": "+_wppaFullNames[p][_wppaCurIdx[p]]+"</a>";break;case"none":a=_wppaFullNames[p][_wppaCurIdx[p]];break;default:a=""}return wppaRepairBrTags(a)}function wppaMakeTheSlideHtml(p,a,e){var t,i=_wppaIsVideo[p][e]?"video":"img",w="title";"wppa"==wppaLightBox[p]&&(w="data-lbtitle");var r=""==wppaLightBox[p]?' onpause="wppaVideoPlaying['+p+'] = false;" onplay="wppaVideoPlaying['+p+'] = true;"':"";if(""!=_wppaLinkUrl[p][e])t=wppaSlideToFullpopup?'<a onclick="wppaStopAudio();wppaStopShow('+p+");"+_wppaLinkUrl[p][e]+'" target="'+_wppaLinkTarget[p][e]+'" title="'+_wppaLinkTitle[p][e]+'"><'+i+r+' title="'+_wppaLinkTitle[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e]+"</a>":"<a onclick=\"_bumpClickCount('"+_wppaId[p][e]+"');wppaStopAudio();wppaStopShow("+p+");window.open('"+_wppaLinkUrl[p][e]+"', '"+_wppaLinkTarget[p][e]+'\');" title="'+_wppaLinkTitle[p][e]+'"><'+i+r+' title="'+_wppaLinkTitle[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e]+"</a>";else if(""==wppaLightBox[p])t="<"+i+r+' title="'+_wppaNames[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e];else{for(var o="",n=0,s=wppaLightboxSingle[p]?"":"[slide-"+p+"-"+a+"]";n<e;)o+='<a href="'+(wppaOvlHires||"wppa"!=wppaLightBox[p]?_wppaHiresUrl[p][n]:wppaMakeFullsizeUrl(_wppaUrl[p][n]))+'"'+(_wppaIsVideo[p][n]?' data-videonatwidth="'+_wppaVideoNatWidth[p][n]+'" data-videonatheight="'+_wppaVideoNatHeight[p][n]+'" data-videohtml="'+encodeURI(_wppaVideoHtml[p][n])+'"':"")+(""!=_wppaAudioHtml[p][n]?' data-audiohtml="'+encodeURI(_wppaAudioHtml[p][n])+'"':"")+" "+w+'="'+_wppaLbTitle[p][n]+'" '+wppaRel+'="'+wppaLightBox[p]+s+'"></a>',n++;for(o+='<a href="'+(wppaOvlHires||"wppa"!=wppaLightBox[p]?_wppaHiresUrl[p][e]:wppaMakeFullsizeUrl(_wppaUrl[p][e]))+'" onclick="wppaStopAudio();wppaStopShow('+p+');" style="cursor:pointer;" target="'+_wppaLinkTarget[p][e]+'"'+(_wppaIsVideo[p][n]?' data-videonatwidth="'+_wppaVideoNatWidth[p][e]+'" data-videonatheight="'+_wppaVideoNatHeight[p][e]+'" data-videohtml="'+encodeURI(_wppaVideoHtml[p][e])+'"':"")+(""!=_wppaAudioHtml[p][n]?' data-audiohtml="'+encodeURI(_wppaAudioHtml[p][e])+'"':"")+" "+w+'="'+_wppaLbTitle[p][e]+'" '+wppaRel+'="'+wppaLightBox[p]+s+'"><'+i+r+' title="'+_wppaLinkTitle[p][e]+'" id="theimg'+a+"-"+p+'" '+_wppaSlides[p][e]+"</a>",n=e+1;n<_wppaUrl[p].length;)o+='<a href="'+(wppaOvlHires||"wppa"!=wppaLightBox[p]?_wppaHiresUrl[p][n]:wppaMakeFullsizeUrl(_wppaUrl[p][n]))+'"'+(_wppaIsVideo[p][n]?' data-videonatwidth="'+_wppaVideoNatWidth[p][n]+'" data-videonatheight="'+_wppaVideoNatHeight[p][n]+'" data-videohtml="'+encodeURI(_wppaVideoHtml[p][n])+'"':"")+(""!=_wppaAudioHtml[p][n]?' data-audiohtml="'+encodeURI(_wppaAudioHtml[p][n])+'"':"")+" "+w+'="'+_wppaLbTitle[p][n]+'" '+wppaRel+'="'+wppaLightBox[p]+s+'"></a>',n++;t=o}""!=_wppaAudioHtml[p][e]&&(t+='<audio controls id="wppa-audio-'+_wppaId[p][e]+"-"+p+'" class="wppa-audio-'+p+" wppa-audio-"+_wppaId[p][e]+"-"+p+'" data-from="wppa" onplay="wppaAudioPlaying['+p+'] = true;" onpause="wppaAudioPlaying['+p+'] = false" style="position:relative;top:-'+(wppaAudioHeight+wppaSlideBorderWidth)+"px;z-index:10;width:"+_wppaVideoNatWidth[p][e]+'px;padding:0;box-sizing:border-box;" >'+_wppaAudioHtml[p][e]+"</audio>"),t=t.replace(/title=""/g,""),jQuery("#theslide"+a+"-"+p).html(t)}function _wppaAdjustFilmstrip(p){if(document.getElementById("wppa-filmstrip-"+p)){var a;if(jQuery(".wppa-film-"+p).removeClass("wppa-filmthumb-active"),_wppaFilmNoMove[p])_wppaFilmNoMove[p]=!1;else a=wppaFilmStripLength[p]/2-(_wppaCurIdx[p]+.5+wppaPreambule[p])*wppaThumbnailPitch[p]-wppaFilmStripMargin[p],wppaFilmShowGlue&&(a-=2*wppaFilmStripMargin[p]+2),jQuery("#wppa-filmstrip-"+p).stop().animate({marginLeft:a+"px"},wppaAnimationSpeed);if(-1!=_wppaCurIdx[p]){var e=_wppaCurIdx[p]-10;e<0&&(e=0);var t=_wppaCurIdx[p]+10;t>_wppaSlides[p].length&&(t=_wppaSlides[p].length);for(var i=0;i<_wppaSlides[p].length;){jQuery("#film_wppatnf_"+_wppaId[p][i]+"_"+p).html()&&(jQuery(window).trigger("scroll"),""!=jQuery("#wppa-film-"+i+"-"+p).attr("data-title")?(jQuery("#wppa-film-"+i+"-"+p).attr("title",jQuery("#wppa-film-"+i+"-"+p).attr("data-title")),jQuery("#wppa-pre-"+i+"-"+p).attr("title",jQuery("#wppa-film-"+i+"-"+p).attr("data-title"))):""!=wppaFilmThumbTitle&&_wppaCurIdx[p]==i?(jQuery("#wppa-film-"+i+"-"+p).attr("title",wppaFilmThumbTitle),jQuery("#wppa-pre-"+i+"-"+p).attr("title",wppaFilmThumbTitle)):(jQuery("#wppa-film-"+i+"-"+p).attr("title",wppaClickToView+" "+_wppaNames[p][i]),jQuery("#wppa-pre-"+i+"-"+p).attr("title",wppaClickToView+" "+_wppaNames[p][i]))),i++}}jQuery("#wppa-film-"+_wppaCurIdx[p]+"-"+p).addClass("wppa-filmthumb-active")}}function _wppaNext(p){(wppaSlideWrap[p]||_wppaCurIdx[p]!=_wppaSlides[p].length-1)&&(_wppaNxtIdx[p]=_wppaCurIdx[p]+1,_wppaNxtIdx[p]==_wppaSlides[p].length&&(_wppaNxtIdx[p]=0),_wppaNextSlide(p,0))}function _wppaNextN(p,a){if(wppaSlideWrap[p]||!(_wppaCurIdx[p]>=_wppaSlides[p].length-a)){for(_wppaNxtIdx[p]=_wppaCurIdx[p]+a;_wppaNxtIdx[p]>=_wppaSlides[p].length;)_wppaNxtIdx[p]-=_wppaSlides[p].length;_wppaNextSlide(p,0)}}function _wppaNextOnCallback(p){if(wppaSlideWrap[p]||_wppaCurIdx[p]!=_wppaSlides[p].length-1){if(_wppaSkipRated[p]){var a=_wppaCurIdx[p]+1;a==_wppaSlides[p].length&&(a=0);var e=a;if(0!=_wppaMyr[p][e]){for(++a==_wppaSlides[p].length&&(a=0);a!=e&&0!=_wppaMyr[p][a];)++a==_wppaSlides[p].length&&(a=0);e=a}_wppaNxtIdx[p]=e}else _wppaNxtIdx[p]=_wppaCurIdx[p]+1,_wppaNxtIdx[p]==_wppaSlides[p].length&&(_wppaNxtIdx[p]=0);_wppaNextSlide(p,0)}}function _wppaPrev(p){(wppaSlideWrap[p]||0!=_wppaCurIdx[p])&&(_wppaNxtIdx[p]=_wppaCurIdx[p]-1,_wppaNxtIdx[p]<0&&(_wppaNxtIdx[p]=_wppaSlides[p].length-1),_wppaNextSlide(p,0))}function _wppaPrevN(p,a){if(wppaSlideWrap[p]||!(_wppaCurIdx[p]<a)){for(_wppaNxtIdx[p]=_wppaCurIdx[p]-a;_wppaNxtIdx[p]<0;)_wppaNxtIdx[p]+=_wppaSlides[p].length;_wppaNextSlide(p,0)}}function _wppaGoto(p,a){_wppaToTheSame=_wppaNxtIdx[p]==a,_wppaNxtIdx[p]=a,_wppaNextSlide(p,0)}function _wppaGotoRunning(p,a){_wppaIsBusy[p]?setTimeout("_wppaGotoRunning( "+p+","+a+" )",10):(wppaConsoleLog("GotoRunning "+p),_wppaSSRuns[p]=!1,_wppaToTheSame=_wppaNxtIdx[p]==a,_wppaNxtIdx[p]=a,__wppaOverruleRun=!0,_wppaNextSlide(p,"manual"),_wppaGotoContinue(p))}function _wppaGotoContinue(p){_wppaIsBusy[p]?setTimeout("_wppaGotoContinue( "+p+" )",10):setTimeout("_wppaNextSlide( "+p+', "reset" )',wppaGetSlideshowTimeout(p)+10)}function _wppaStart(p,a){"icons"==wppaSlideshowNavigationType?_wppaStartIcons(p,a):_wppaStartText(p,a)}function _wppaStartIcons(p,a){if(-2==a){var e=0;if(a=0,_wppaSkipRated[p]=!0,0!=_wppaMyr[p][e])for(;e<_wppaSlides[p].length;)0==a&&0==_wppaMyr[p][e]&&(a=e),e++}var t=wppaIconSize(p,"1.5em",!1);-1<a?(jQuery("#startstop-"+p).html(wppaSvgHtml("Play-Button",t,!1,!0,"0","10","20","50")),jQuery("#speed0-"+p).hide(),jQuery("#speed1-"+p).hide(),_wppaNxtIdx[p]=a,_wppaCurIdx[p]=a,_wppaNextSlide(p,0),_wppaShowMetaData(p,"show")):(_wppaSSRuns[p]=!0,_wppaNextSlide(p,0),jQuery("#startstop-"+p).html(wppaSvgHtml("Pause-Button",t,!1,!0,"0","10","20","50")),jQuery("#speed0-"+p).show(),jQuery("#speed1-"+p).show(),_wppaShowMetaData(p,"hide"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(wppaSlideShow):jQuery("#bc-pname-"+p).html(wppaSlideShow)),_wppaSetRatingDisplay(p)}function _wppaStartText(p,a){if(-2==a){var e=0;if(a=0,_wppaSkipRated[p]=!0,0!=_wppaMyr[p][e])for(;e<_wppaSlides[p].length;)0==a&&0==_wppaMyr[p][e]&&(a=e),e++}-1<a?(jQuery("#startstop-"+p).html(wppaStart+" "+wppaSlideShow),jQuery("#speed0-"+p).css("display","none"),jQuery("#speed1-"+p).css("display","none"),_wppaNxtIdx[p]=a,_wppaCurIdx[p]=a,_wppaNextSlide(p,0),_wppaShowMetaData(p,"show")):(_wppaSSRuns[p]=!0,_wppaNextSlide(p,0),jQuery("#startstop-"+p).html(wppaStop),jQuery("#speed0-"+p).css("display","inline"),jQuery("#speed1-"+p).css("display","inline"),_wppaShowMetaData(p,"hide"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(wppaSlideShow):jQuery("#bc-pname-"+p).html(wppaSlideShow)),_wppaSetRatingDisplay(p)}function _wppaStop(p){"icons"==wppaSlideshowNavigationType?_wppaStopIcons(p):_wppaStopText(p)}function _wppaStopIcons(p){_wppaSSRuns[p]=!1,jQuery("#startstop-"+p).html(wppaSvgHtml("Play-Button",wppaIconSize(p,"1.5em",!1),!1,!0)),jQuery("#speed0-"+p).hide(),jQuery("#speed1-"+p).hide(),_wppaShowMetaData(p,"show"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(_wppaNames[p][_wppaCurIdx[p]]):jQuery("#bc-pname-"+p).html(_wppaNames[p][_wppaCurIdx[p]])}function _wppaStopText(p){_wppaSSRuns[p]=!1,jQuery("#startstop-"+p).html(wppaStart+" "+wppaSlideShow),jQuery("#speed0-"+p).css("display","none"),jQuery("#speed1-"+p).css("display","none"),_wppaShowMetaData(p,"show"),jQuery("#bc-pname-modal-"+p)?jQuery("#bc-pname-modal-"+p).html(_wppaNames[p][_wppaCurIdx[p]]):jQuery("#bc-pname-"+p).html(_wppaNames[p][_wppaCurIdx[p]])}function _wppaSpeed(p,a){"random"!=_wppaTimeOut[p]&&(a?500<_wppaTimeOut[p]&&(_wppaTimeOut[p]/=1.5):_wppaTimeOut[p]<6e4&&(_wppaTimeOut[p]*=1.5))}function _wppaLoadSpinner(p){}function _wppaUnloadSpinner(p){jQuery("#wppa-slide-spin-"+p).stop().fadeOut(),setTimeout(function(){jQuery("#wppa-slide-spin-"+p).stop().fadeOut()},1e3)}function _wppaCheckRewind(p){var a,e,t;document.getElementById("wppa-filmstrip-"+p)&&((a=Math.abs(_wppaCurIdx[p]-_wppaNxtIdx[p]))<=wppaFilmPageSize[p]||(wppaFilmStripLength[p]/wppaThumbnailPitch[p]+1)/2<=a&&(e=wppaThumbnailPitch[p]*_wppaSlides[p].length,wppaFilmShowGlue&&(e+=2+2*wppaFilmStripMargin[p]),t=parseInt(jQuery("#wppa-filmstrip-"+p).css("margin-left")),_wppaNxtIdx[p]>_wppaCurIdx[p]?t-=e:t+=e,jQuery("#wppa-filmstrip-"+p).css("margin-left",t+"px")))}function _wppaSetRatingDisplay(p){var a,e,t,w,r;if(document.getElementById("wppa-rating-"+p)&&void 0!==(a=_wppaAvg[p][_wppaCurIdx[p]])){if("likes"==wppaRatingDisplayType){var o=a.split("|");return jQuery("#wppa-like-"+p).attr("title",o[0]),jQuery("#wppa-liketext-"+p).html(o[1]),void("1"==_wppaMyr[p][_wppaCurIdx[p]]?jQuery("#wppa-like-"+p).attr("src",wppaImageDirectory+"thumbdown.png"):jQuery("#wppa-like-"+p).attr("src",wppaImageDirectory+"thumbup.png"))}if(a=(e=a.split("|"))[0],t=e[1],w=_wppaDisc[p][_wppaCurIdx[p]],r=_wppaMyr[p][_wppaCurIdx[p]],"graphic"==wppaRatingDisplayType)_wppaSetRd(p,a,"#wppa-avg-"),_wppaSetRd(p,r,"#wppa-rate-"),0==r?(jQuery("#wppa-dislike-"+p).css("display","inline"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","inline"),document.getElementById("wppa-dislike-"+p)&&jQuery("#wppa-filler-"+p).css("display","none"),jQuery("#wppa-dislike-"+p).stop().fadeTo(100,wppaStarOpacity)):(jQuery("#wppa-dislike-"+p).css("display","none"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","none"),jQuery("#wppa-filler-"+p).css("display","inline"),jQuery("#wppa-filler-"+p).stop().fadeTo(100,wppaStarOpacity),jQuery("#wppa-filler-"+p).attr("title",w));else{if(jQuery("#wppa-numrate-avg-"+p).html(a+" ( "+t+" ) "),wppaRatingOnce&&0<r)jQuery("#wppa-numrate-mine-"+p).html(r);else if(r<0)jQuery("#wppa-numrate-mine-"+p).html(" dislike");else{var n="";for(i=1;i<=wppaRatingMax;i++)r==i?n+='<span style="cursor:pointer; font-weight:bold;" onclick="_wppaRateIt( '+p+", "+i+' )">&nbsp;'+i+"&nbsp;</span>":(r>i-1&&r<i&&(n+="&nbsp;( "+r+" )&nbsp;"),n+='<span style="cursor:pointer;" onclick="_wppaRateIt( '+p+", "+i+' )" onmouseover="this.style.fontWeight=\'bold\'" onmouseout="this.style.fontWeight=\'normal\'" >&nbsp;'+i+"&nbsp;</span>");jQuery("#wppa-numrate-mine-"+p).html(n)}0==r?(jQuery("#wppa-dislike-"+p).css("display","inline"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","inline"),jQuery("#wppa-filler-"+p).css("display","none"),jQuery("#wppa-dislike-"+p).stop().fadeTo(100,wppaStarOpacity)):(jQuery("#wppa-dislike-"+p).css("display","none"),jQuery("#wppa-dislike-imgdiv-"+p).css("display","none"),jQuery("#wppa-filler-"+p).css("display","inline")),jQuery("#wppa-discount-"+p).html(w+"&bull; "),jQuery("#wppa-filler-"+p).css("display","none")}0==r?jQuery("#wppa-vote-button-"+p).val(wppaVoteForMe):jQuery("#wppa-vote-button-"+p).val(wppaVotedForMe),jQuery("#wppa-vote-count-"+p).html(t)}}function wppaGetDislikeText(p,a,e){return p}function _wppaSetRd(p,a,e){var t=parseInt(a),i=t+1,w=wppaStarOpacity+(a-t)*(1-wppaStarOpacity),r=wppaRatingMax;for(idx=1;idx<=r;idx++)"#wppa-rate-"!=e&&".wppa-rate-"!=e||jQuery(e+p+"-"+idx).attr("src")!=wppaImageDirectory+"star.ico"&&jQuery(e+p+"-"+idx).attr("src",wppaImageDirectory+"star.ico"),idx<=t?jQuery(e+p+"-"+idx).stop().fadeTo(100,1):idx==i?jQuery(e+p+"-"+idx).stop().fadeTo(100,w):jQuery(e+p+"-"+idx).stop().fadeTo(100,wppaStarOpacity)}function _wppaFollowMe(p,a){_wppaSSRuns[p]||0!=_wppaMyr[p][_wppaCurIdx[p]]&&wppaRatingOnce||_wppaMyr[p][_wppaCurIdx[p]]<0||_wppaVoteInProgress||_wppaSetRd(p,a,"#wppa-rate-")}function wppaOvlFollowMe(p,a,e){e||_wppaSetRd(p,a,".wppa-rate-")}function _wppaLeaveMe(p,a){_wppaSSRuns[p]||0!=_wppaMyr[p][_wppaCurIdx[p]]&&wppaRatingOnce||_wppaMyr[p][_wppaCurIdx[p]]<0||_wppaVoteInProgress||_wppaSetRd(p,_wppaMyr[p][_wppaCurIdx[p]],"#wppa-rate-")}function wppaOvlLeaveMe(p,a,e){_wppaSetRd(p,e,".wppa-rate-")}function _wppaValidateComment(p,a){if(a||(a=_wppaId[p][_wppaCurIdx[p]]),jQuery("#wppa-comname-"+p).val().length<1)return alert(wppaPleaseName),!1;if("required"==wppaEmailRequired||"optional"==wppaEmailRequired){var e=jQuery("#wppa-comemail-"+p).val();if("optional"==wppaEmailRequired&&0==e.length)return!0;var t=e.indexOf("@"),i=e.lastIndexOf(".");if(t<1||i<t+2||i+2>=e.length)return alert(wppaPleaseEmail),!1}return!(jQuery("#wppa-comment-"+p).val().length<1)||(alert(wppaPleaseComment),!1)}function _wppaGo(p){document.location=p}function _wppaBbb(p,a,e){if(!_wppaSSRuns[p]){var t="#bbb-"+p+"-"+a;switch(e){case"show":"l"==a&&jQuery(t).attr("title",wppaPreviousPhoto),"r"==a&&jQuery(t).attr("title",wppaNextPhoto),jQuery(".bbb-"+p).css("cursor","pointer");break;case"hide":jQuery(".bbb-"+p).removeAttr("title"),jQuery(".bbb-"+p).css("cursor","default");break;case"click":"l"==a&&wppaPrev(p),"r"==a&&wppaNext(p);break;default:alert("Unimplemented instruction: "+e+" on: "+t)}}}function _wppaUbb(p,a,e){var t="#ubb-"+p+"-"+a;switch(e){case"show":"l"==a&&jQuery(t).attr("title",wppaPreviousPhoto),"r"==a&&jQuery(t).attr("title",wppaNextPhoto),jQuery(".ubb-"+p).css("cursor","pointer"),jQuery(".ubb-"+p).stop().fadeTo(200,.8),jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(200,.8);break;case"hide":jQuery(".ubb-"+p).removeAttr("title"),jQuery(".ubb-"+p).css("cursor","default"),jQuery(".ubb-"+p).stop().fadeTo(200,0),jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(200,0);break;case"click":var i;if("l"==a&&(i=_wppaCurIdx[p]-1)<0){if(!wppaSlideWrap[p])return;i=_wppaSlides[p].length-1}if("r"==a&&(i=_wppaCurIdx[p]+1)==_wppaSlides[p].length){if(!wppaSlideWrap[p])return;i=0}wppaIsMobile&&(jQuery(".ubb-"+p).stop().fadeTo(200,1).fadeTo(1e3,0),jQuery("#wppa-startstop-icon-"+p).stop().fadeTo(200,1).fadeTo(1e3,0)),wppaGotoKeepState(p,i);break;default:alert("Unimplemented instruction: "+e+" on: "+t)}}function wppaOpenComments(p){_wppaSSRuns[p]&&_wppaStop(p),jQuery("#wppa-comtable-wrap-"+p).css("display","block"),jQuery("#wppa-comform-wrap-"+p).css("display","block"),jQuery("#wppa-comfooter-wrap-"+p).css("display","none"),wppaColWidth[p]=0,setTimeout("_wppaDoAutocol( "+p+" )",100)}function _wppaShowMetaData(p,a){_wppaSSRuns[p]||__wppaOverruleRun?"show"==a?wppaFotomotoHideWhenRunning||wppaFotomotoToolbar(p,_wppaHiresUrl[p][_wppaCurIdx[p]]):wppaShareHideWhenRunning&&jQuery("#wppa-share-"+p).css("display","none"):"show"==a?(wppaAutoOpenComments&&(jQuery("#wppa-comtable-wrap-"+p).css("display","block"),jQuery("#wppa-comform-wrap-"+p).css("display","block"),jQuery("#wppa-comfooter-wrap-"+p).css("display","none")),0!=_wppaCurIdx[p]&&jQuery(".wppa-first-"+p).show(),_wppaCurIdx[p]!=_wppaSlides[p].length-1&&jQuery(".wppa-last-"+p).show(),wppaShareHideWhenRunning&&jQuery("#wppa-share-"+p).css("display",""),wppaFotomotoToolbar(p,_wppaHiresUrl[p][_wppaCurIdx[p]])):(jQuery("#wppa-comtable-wrap-"+p).css("display","none"),jQuery("#wppa-comform-wrap-"+p).css("display","none"),jQuery("#wppa-comfooter-wrap-"+p).css("display","block"),wppaFotomotoHide(p)),"show"==a?(jQuery("#imagedesc-"+p).css("visibility","visible"),jQuery("#imagetitle-"+p).css("visibility","visible"),jQuery("#counter-"+p).css("visibility","visible"),jQuery("#iptccontent-"+p).css("visibility","visible"),jQuery("#exifcontent-"+p).css("visibility","visible")):(jQuery("#counter-"+p).css("visibility","hidden"),jQuery(".wppa-first-"+p).hide(),jQuery(".wppa-last-"+p).hide(),jQuery("#iptccontent-"+p).css("visibility","hidden"),jQuery("#exifcontent-"+p).css("visibility","hidden"))}function wppaGetSlideshowTimeout(p){var a;if("random"==_wppaTimeOut[p]){var e=2*wppaAnimationSpeed,t=7*wppaAnimationSpeed;a=Math.floor(Math.random()*(t-e+1))+e}else a=_wppaTimeOut[p];return a}wppaConsoleLog("wppa-slideshow.js version "+wppaJsSlideshowVersion+" loaded.","force");
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
- Version: 6.9.19
6
- Stable tag: 6.9.18
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
@@ -137,6 +137,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
137
 
138
  == Upgrade Notice ==
139
 
 
 
 
 
140
  = 6.9.19 =
141
 
142
  * This version addresses various minor bug fixes
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 6.9.20
6
+ Stable tag: 6.9.19
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
137
 
138
  == Upgrade Notice ==
139
 
140
+ = 6.9.20 =
141
+
142
+ * This version addresses various bug fixes
143
+
144
  = 6.9.19 =
145
 
146
  * This version addresses various minor bug fixes
wppa-admin-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -131,7 +131,7 @@ global $wpdb;
131
  // Find the album( s ) if any
132
  if ( ! $alb && ! $pid ) {
133
  $start_time = get_option( 'wppa_remake_start', '0' );
134
- $albums = $wpdb->get_results( 'SELECT `id` FROM `'.WPPA_ALBUMS.'`', ARRAY_A );
135
  }
136
  elseif ( $alb ) {
137
  $start_time = get_option( 'wppa_remake_start_album_'.$alb, '0' );
@@ -147,7 +147,10 @@ global $wpdb;
147
  if ( $files ) foreach ( $files as $file ) {
148
  if ( ! is_dir( $file ) ) {
149
  $filename = basename( $file );
150
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE `filename` = %s OR ( `filename` = '' AND `name` = %s )", $filename, $filename ), ARRAY_A );
 
 
 
151
  if ( $photos ) foreach ( $photos as $photo ) { // Photo exists
152
  $modified_time = $photo['modified'];
153
  if ( $modified_time < $start_time ) {
@@ -248,11 +251,12 @@ global $wpdb;
248
 
249
  $err = '1';
250
  // Check args
251
- if ( !is_numeric( $photoid ) || !is_numeric( $albumto ) ) return $err;
252
 
253
  $err = '2';
254
  // Find photo details
255
- $photo = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_PHOTOS.' WHERE id = %s', $photoid ), 'ARRAY_A' );
 
256
  if ( ! $photo ) return $err;
257
  $albumfrom = $photo['album'];
258
  $album = $albumto;
@@ -343,7 +347,7 @@ global $wpdb;
343
  function wppa_copy_exif( $fromphoto, $tophoto ) {
344
  global $wpdb;
345
 
346
- $exiflines = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPPA_EXIF."` WHERE `photo` = %s", $fromphoto ), ARRAY_A );
347
  if ( $exiflines ) foreach ( $exiflines as $line ) {
348
  $bret = wppa_create_exif_entry( array( 'photo' => $tophoto, 'tag' => $line['tag'], 'description' => $line['description'], 'status' => $line['status'] ) );
349
  }
@@ -351,7 +355,7 @@ global $wpdb;
351
  function wppa_copy_iptc( $fromphoto, $tophoto ) {
352
  global $wpdb;
353
 
354
- $iptclines = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPPA_IPTC."` WHERE `photo` = %s", $fromphoto ), ARRAY_A );
355
  if ( $iptclines ) foreach ( $iptclines as $line ) {
356
  $bret = wppa_create_iptc_entry( array( 'photo' => $tophoto, 'tag' => $line['tag'], 'description' => $line['description'], 'status' => $line['status'] ) );
357
  }
@@ -366,7 +370,8 @@ global $wpdb;
366
 
367
  // Get the ext
368
  $err = '2';
369
- $ext = $wpdb->get_var( $wpdb->prepare( 'SELECT ext FROM '.WPPA_PHOTOS.' WHERE id = %s', $id ) );
 
370
  if ( ! $ext ) return $err;
371
 
372
  // Get the image
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
+ * Version 6.9.20
7
  *
8
  */
9
 
131
  // Find the album( s ) if any
132
  if ( ! $alb && ! $pid ) {
133
  $start_time = get_option( 'wppa_remake_start', '0' );
134
+ $albums = $wpdb->get_results( "SELECT id FROM $wpdb->wppa_albums", ARRAY_A );
135
  }
136
  elseif ( $alb ) {
137
  $start_time = get_option( 'wppa_remake_start_album_'.$alb, '0' );
147
  if ( $files ) foreach ( $files as $file ) {
148
  if ( ! is_dir( $file ) ) {
149
  $filename = basename( $file );
150
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
151
+ WHERE filename = %s
152
+ OR ( filename = '' AND name = %s )", $filename, $filename ), ARRAY_A );
153
+
154
  if ( $photos ) foreach ( $photos as $photo ) { // Photo exists
155
  $modified_time = $photo['modified'];
156
  if ( $modified_time < $start_time ) {
251
 
252
  $err = '1';
253
  // Check args
254
+ if ( ! is_numeric( $photoid ) || ! is_numeric( $albumto ) ) return $err;
255
 
256
  $err = '2';
257
  // Find photo details
258
+ $photo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
259
+ WHERE id = %s", $photoid ), ARRAY_A );
260
  if ( ! $photo ) return $err;
261
  $albumfrom = $photo['album'];
262
  $album = $albumto;
347
  function wppa_copy_exif( $fromphoto, $tophoto ) {
348
  global $wpdb;
349
 
350
+ $exiflines = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif WHERE photo = %d", $fromphoto ), ARRAY_A );
351
  if ( $exiflines ) foreach ( $exiflines as $line ) {
352
  $bret = wppa_create_exif_entry( array( 'photo' => $tophoto, 'tag' => $line['tag'], 'description' => $line['description'], 'status' => $line['status'] ) );
353
  }
355
  function wppa_copy_iptc( $fromphoto, $tophoto ) {
356
  global $wpdb;
357
 
358
+ $iptclines = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_iptc WHERE photo = %d", $fromphoto ), ARRAY_A );
359
  if ( $iptclines ) foreach ( $iptclines as $line ) {
360
  $bret = wppa_create_iptc_entry( array( 'photo' => $tophoto, 'tag' => $line['tag'], 'description' => $line['description'], 'status' => $line['status'] ) );
361
  }
370
 
371
  // Get the ext
372
  $err = '2';
373
+ $ext = $wpdb->get_var( $wpdb->prepare( "SELECT ext FROM $wpdb->wppa_photos
374
+ WHERE id = %d", $id ) );
375
  if ( ! $ext ) return $err;
376
 
377
  // Get the image
wppa-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
- * Version 6.9.14
7
  *
8
  */
9
 
@@ -35,7 +35,7 @@ function wppa_add_admin() {
35
 
36
  // See if there are comments pending moderation
37
  $com_pending = '';
38
- $com_pending_count = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_COMMENTS."` WHERE `status` = 'pending' OR `status` = 'spam'" );
39
  if ( $com_pending_count ) $com_pending = '<span class="update-plugins"><span class="plugin-count">'.$com_pending_count.'</span></span>';
40
 
41
  // See if there are uploads pending moderation
@@ -55,7 +55,7 @@ function wppa_add_admin() {
55
  // page_title menu_title capability menu_slug function icon_url position
56
  add_menu_page( 'WP Photo Album', __('Photo&thinsp;Albums', 'wp-photo-album-plus').$tot_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin', $icon_url ); //,'10' );
57
 
58
- // parent_slug page_title menu_title capability menu_slug function
59
  add_submenu_page( 'wppa_admin_menu', __('Album Admin', 'wp-photo-album-plus'), __('Album Admin', 'wp-photo-album-plus').$upl_pending,'wppa_admin', 'wppa_admin_menu', 'wppa_admin' );
60
  add_submenu_page( 'wppa_admin_menu', __('Upload Photos', 'wp-photo-album-plus'), __('Upload Photos', 'wp-photo-album-plus'), 'wppa_upload', 'wppa_upload_photos', 'wppa_page_upload' );
61
  // Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos
@@ -420,7 +420,7 @@ if ( get_option( 'wppa_enable_panorama' ) == 'yes' ) {
420
  add_action( 'admin_footer', 'wppa_load_panorama_js' );
421
  }
422
  function wppa_load_panorama_js() {
423
-
424
  if ( wppa( 'has_panorama' ) ) {
425
  if ( is_file ( WPPA_PATH . '/js/wppa-panorama.min.js' ) ) {
426
  $three_url = WPPA_URL . '/js/wppa-panorama.min.js';
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains the admin menu and startups the admin pages
6
+ * Version 6.9.20
7
  *
8
  */
9
 
35
 
36
  // See if there are comments pending moderation
37
  $com_pending = '';
38
+ $com_pending_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_comments WHERE status = 'pending' OR status = 'spam'" );
39
  if ( $com_pending_count ) $com_pending = '<span class="update-plugins"><span class="plugin-count">'.$com_pending_count.'</span></span>';
40
 
41
  // See if there are uploads pending moderation
55
  // page_title menu_title capability menu_slug function icon_url position
56
  add_menu_page( 'WP Photo Album', __('Photo&thinsp;Albums', 'wp-photo-album-plus').$tot_pending, 'wppa_admin', 'wppa_admin_menu', 'wppa_admin', $icon_url ); //,'10' );
57
 
58
+ // parent_slug page_title menu_title capability menu_slug function
59
  add_submenu_page( 'wppa_admin_menu', __('Album Admin', 'wp-photo-album-plus'), __('Album Admin', 'wp-photo-album-plus').$upl_pending,'wppa_admin', 'wppa_admin_menu', 'wppa_admin' );
60
  add_submenu_page( 'wppa_admin_menu', __('Upload Photos', 'wp-photo-album-plus'), __('Upload Photos', 'wp-photo-album-plus'), 'wppa_upload', 'wppa_upload_photos', 'wppa_page_upload' );
61
  // Uploader without album admin rights, but when the upload_edit switch set, may edit his own photos
420
  add_action( 'admin_footer', 'wppa_load_panorama_js' );
421
  }
422
  function wppa_load_panorama_js() {
423
+
424
  if ( wppa( 'has_panorama' ) ) {
425
  if ( is_file ( WPPA_PATH . '/js/wppa-panorama.min.js' ) ) {
426
  $three_url = WPPA_URL . '/js/wppa-panorama.min.js';
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 6.9.17
6
  *
7
  */
8
 
@@ -84,7 +84,7 @@ global $wppa_log_file;
84
  break;
85
  case 'getssiptclist':
86
  $tag = str_replace( 'H', '#', $_REQUEST['tag'] );
87
- $mocc = $_REQUEST['moccur'];
88
  $oldvalue = '';
89
  if ( strpos( $wppa_session['supersearch'], ',' ) !== false ) {
90
  $ss_data = explode( ',', $wppa_session['supersearch'] );
@@ -99,7 +99,7 @@ global $wppa_log_file;
99
  }
100
  }
101
  $iptcdata = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT description
102
- FROM {$wpdb->prefix}wppa_iptc
103
  WHERE photo > 0 AND tag = %s
104
  ORDER BY description", $tag ), ARRAY_A );
105
  $last = '';
@@ -124,7 +124,7 @@ global $wppa_log_file;
124
  }
125
  }
126
  if ( ! $any ) {
127
- $query = $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_iptc
128
  SET status = 'hide'
129
  WHERE photo = 0 AND tag = %s", $tag );
130
  $wpdb->query( $query );
@@ -162,7 +162,7 @@ global $wppa_log_file;
162
 
163
  if ( $brand ) {
164
  $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT f_description
165
- FROM {$wpdb->prefix}wppa_exif
166
  WHERE photo > 0
167
  AND tag = %s
168
  AND brand = %s
@@ -172,7 +172,7 @@ global $wppa_log_file;
172
  }
173
  else {
174
  $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT f_description
175
- FROM {$wpdb->prefix}wppa_exif
176
  WHERE photo > 0
177
  AND tag = %s
178
  AND f_description <> %s
@@ -240,7 +240,7 @@ global $wppa_log_file;
240
 
241
  // Cleanup possible unused label
242
  if ( ! $any ) {
243
- $query = $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_exif
244
  SET status = 'hide'
245
  WHERE photo = 0
246
  AND tag = %s", $tag );
@@ -413,18 +413,18 @@ global $wppa_log_file;
413
  }
414
 
415
  if ( $pid && current_user_can( 'wppa_moderate' ) ) {
416
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos
417
  SET status = 'publish'
418
  WHERE id = %d", $pid ) );
419
  wppa_flush_upldr_cache( 'photoid', $pid );
420
- $alb = $wpdb->get_var( $wpdb->prepare( "SELECT album FROM {$wpdb->prefix}wppa_photos
421
  WHERE id = %d", $pid ) );
422
  wppa_clear_taglist();
423
  wppa_invalidate_treecounts( $alb );
424
  }
425
 
426
  if ( $cid && current_user_can( 'wppa_moderate' ) ) {
427
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_comments
428
  SET status = 'approved'
429
  WHERE id = %d", $cid ) );
430
  if ( $iret ) {
@@ -446,14 +446,14 @@ global $wppa_log_file;
446
  else {
447
  if ( $pid ) {
448
  if ( current_user_can( 'wppa_moderate' ) ) {
449
- echo sprintf( __( 'Failed to update stutus of photo %s' , 'wp-photo-album-plus'), $pid )."\n".__( 'Please refresh the page', 'wp-photo-album-plus' );
450
  }
451
  else {
452
  _e( 'Security check failure' , 'wp-photo-album-plus');
453
  }
454
  }
455
  if ( $cid ) {
456
- echo sprintf( __( 'Failed to update stutus of comment %s' , 'wp-photo-album-plus'), $cid )."\n".__( 'Please refresh the page', 'wp-photo-album-plus' );
457
  }
458
  }
459
  wppa_exit();
@@ -466,6 +466,7 @@ global $wppa_log_file;
466
  // Remove photo
467
  if ( $pid ) {
468
  if ( wppa_may_user_fe_delete( $pid ) ) {
 
469
  wppa_delete_photo( $pid );
470
  echo 'OK||' . __( 'Photo removed', 'wp-photo-album-plus' );
471
  wppa_exit();
@@ -481,10 +482,10 @@ global $wppa_log_file;
481
  wppa_exit();
482
  }
483
 
484
- $photo = $wpdb->get_var( $wpdb->prepare( "SELECT photo FROM {$wpdb->prefix}wppa_comments
485
  WHERE id = %d", $cid ) );
486
 
487
- $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wppa_comments
488
  WHERE id = %d", $cid ) );
489
 
490
  if ( $iret ) {
@@ -515,14 +516,14 @@ global $wppa_log_file;
515
  $alb = wppa_decrypt_album( $_REQUEST['album-id'] );
516
 
517
  if ( is_user_logged_in() ) {
518
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
519
  WHERE album = %d
520
  AND ( ( status <> 'pending'
521
  AND status <> 'scheduled' )
522
  OR owner = %s )";
523
  }
524
  else {
525
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
526
  WHERE album = %d
527
  AND ( ( status <> 'pending'
528
  AND status <> 'scheduled'
@@ -633,7 +634,7 @@ global $wppa_log_file;
633
  $zipfile = $zipsdir.wppa_get_user().'.zip';
634
 
635
  // Find the photo data
636
- $data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
637
  WHERE id = %d", $photo ), ARRAY_A );
638
 
639
  // Find the photo file
@@ -687,7 +688,7 @@ global $wppa_log_file;
687
  wppa_exit();
688
  }
689
 
690
- $data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
691
  WHERE id = %s", $photo ), ARRAY_A );
692
 
693
  if ( $data ) { // The photo is supposed to exist
@@ -888,13 +889,13 @@ global $wppa_log_file;
888
  }
889
 
890
  // Already a pending one?
891
- $pending = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_rating
892
  WHERE photo = %d
893
  AND user = %s
894
  AND status = 'pending'", $photo, $user ) );
895
 
896
  // Has user motivated his vote?
897
- $hascommented = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_comments
898
  WHERE photo = %d
899
  AND user = %s", $photo, wppa_get_user( 'display' ) ) );
900
 
@@ -904,7 +905,7 @@ global $wppa_log_file;
904
  wppa_exit();
905
  }
906
  else {
907
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_rating
908
  SET status = 'publish'
909
  WHERE photo = %d
910
  AND user = %s", $photo, $user ) );
@@ -930,7 +931,7 @@ global $wppa_log_file;
930
  if ( $mylast ) {
931
 
932
  // Remove my like
933
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wppa_rating
934
  WHERE photo = %d
935
  AND user = %s", $photo, $user ) );
936
  $myavgrat = '0';
@@ -1015,7 +1016,7 @@ global $wppa_log_file;
1015
 
1016
  // Case 3: I will change my previously given vote
1017
  elseif ( wppa_switch( 'rating_change' ) ) { // Votechanging is allowed
1018
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_rating
1019
  SET value = %s
1020
  WHERE photo = %d
1021
  AND user = %s
@@ -1042,7 +1043,7 @@ global $wppa_log_file;
1042
  }
1043
 
1044
  // Compute my avg rating
1045
- $myrats = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_rating
1046
  WHERE photo = %d
1047
  AND user = %s
1048
  AND status = 'publish'", $photo, $user ), ARRAY_A );
@@ -1069,7 +1070,9 @@ global $wppa_log_file;
1069
  }
1070
  /*hbi*/
1071
  // Compute new allavgrat
1072
- $ratings = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM '.WPPA_RATING.' WHERE `photo` = %s AND `status` = %s', $photo, 'publish' ), ARRAY_A );
 
 
1073
  if ( $ratings ) {
1074
  $sum = 0;
1075
  $cnt = 0;
@@ -1088,16 +1091,20 @@ global $wppa_log_file;
1088
  else $allavgrat = '0';
1089
 
1090
  // Store it in the photo info
1091
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS. '` SET `mean_rating` = %s WHERE `id` = %s', $allavgrat, $photo ) );
 
 
1092
  if ( $iret === false ) {
1093
  echo '0||106||'.$wartxt;
1094
  wppa_exit(); // Fail on save
1095
  }
1096
 
1097
  // Compute rating_count and store in the photo info
1098
- $ratcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_RATING."` WHERE `photo` = %s", $photo ) );
 
1099
  if ( $ratcount !== false ) {
1100
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos SET `rating_count` = %s WHERE `id` = %s", $ratcount, $photo ) );
 
1101
  if ( $iret === false ) {
1102
  echo '0||107||'.$wartxt;
1103
  wppa_exit(); // Fail on save
@@ -1108,7 +1115,10 @@ global $wppa_log_file;
1108
  $allavgratcombi = $allavgrat.'|'.$ratcount;
1109
 
1110
  // Compute dsilike count
1111
- $discount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_RATING."` WHERE `photo` = %s AND `value` = -1 AND `status` = %s", $photo, 'publish' ) );
 
 
 
1112
  if ( $discount === false ) {
1113
  echo '0||108||'.$wartxt;
1114
  wppa_exit(); // Fail on save
@@ -1178,7 +1188,8 @@ global $wppa_log_file;
1178
  echo '||0||'.__( 'Security check failure' , 'wp-photo-album-plus');
1179
  wppa_exit(); // Nonce check failed
1180
  }
1181
- $album = $wpdb->get_var( $wpdb->prepare( 'SELECT `album` FROM `'.WPPA_PHOTOS.'` WHERE `id` = %s', $photo ) );
 
1182
  wppa_delete_photo( $photo );
1183
  wppa_clear_cache();
1184
  $edit_link = wppa_ea_url( 'single', $tab = 'edit' ) . '&photo=' . $photo;
@@ -1202,7 +1213,8 @@ global $wppa_log_file;
1202
  echo '||0||'.__( 'Security check failure' , 'wp-photo-album-plus');
1203
  wppa_exit(); // Nonce check failed
1204
  }
1205
- $album = $wpdb->get_var( $wpdb->prepare( 'SELECT `album` FROM `'.WPPA_PHOTOS.'` WHERE `id` = %s', $photo ) );
 
1206
  if ( wppa_is_int( $album ) && $album < '-9' ) {
1207
  wppa_update_photo( array( 'id' => $photo, 'album' => - ( $album + '9' ) ) );
1208
  wppa_invalidate_treecounts( - ( $album + '9' ) );
@@ -1229,10 +1241,12 @@ global $wppa_log_file;
1229
 
1230
  switch ( $item ) {
1231
  case 'clear_ratings':
1232
- $photos = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `album` = %s', $album ), ARRAY_A );
 
1233
  if ( $photos ) foreach ( $photos as $photo ) {
1234
- $iret1 = $wpdb->query( $wpdb->prepare( 'DELETE FROM `'.WPPA_RATING.'` WHERE `photo` = %s', $photo['id'] ) );
1235
- $iret2 = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `mean_rating` = %s WHERE `id` = %s', '', $photo['id'] ) );
 
1236
  }
1237
  if ( $photos && $iret1 !== false && $iret2 !== false ) {
1238
  echo '||0||'.__( 'Ratings cleared' , 'wp-photo-album-plus').'||'.__( 'No ratings for this photo.' , 'wp-photo-album-plus');
@@ -1246,13 +1260,19 @@ global $wppa_log_file;
1246
  wppa_exit();
1247
  break;
1248
  case 'set_deftags': // to be changed for large albums
1249
- $photos = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `album` = %s', $album ), ARRAY_A );
1250
- $deftag = $wpdb->get_var( $wpdb->prepare( 'SELECT `default_tags` FROM `'.WPPA_ALBUMS.'` WHERE `id` = %s', $album ) );
 
 
 
 
1251
  if ( is_array( $photos ) ) foreach ( $photos as $photo ) {
1252
 
1253
  $tags = wppa_sanitize_tags( wppa_filter_iptc( wppa_filter_exif( $deftag, $photo['id'] ), $photo['id'] ) );
1254
 
1255
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `tags` = %s WHERE `id` = %s', $tags, $photo['id'] ) );
 
 
1256
  wppa_index_update( 'photo', $photo['id'] );
1257
  }
1258
  if ( $photos && $iret !== false ) {
@@ -1268,13 +1288,19 @@ global $wppa_log_file;
1268
  wppa_exit();
1269
  break;
1270
  case 'add_deftags':
1271
- $photos = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `album` = %s', $album ), ARRAY_A );
1272
- $deftag = $wpdb->get_var( $wpdb->prepare( 'SELECT `default_tags` FROM `'.WPPA_ALBUMS.'` WHERE `id` = %s', $album ) );
 
 
 
 
1273
  if ( is_array( $photos ) ) foreach ( $photos as $photo ) {
1274
 
1275
  $tags = wppa_sanitize_tags( wppa_filter_iptc( wppa_filter_exif( $photo['tags'].','.$deftag, $photo['id'] ), $photo['id'] ) );
1276
 
1277
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `tags` = %s WHERE `id` = %s', $tags, $photo['id'] ) );
 
 
1278
  wppa_index_update( 'photo', $photo['id'] );
1279
  }
1280
  if ( $photos && $iret !== false ) {
@@ -1377,14 +1403,16 @@ global $wppa_log_file;
1377
  case 'upload_limit_count':
1378
  wppa_ajax_check_range( $value, false, '0', false, __( 'Upload limit count' , 'wp-photo-album-plus') );
1379
  if ( wppa( 'error' ) ) wppa_exit();
1380
- $oldval = $wpdb->get_var( $wpdb->prepare( 'SELECT `upload_limit` FROM '.WPPA_ALBUMS.' WHERE `id` = %s', $album ) );
 
1381
  $temp = explode( '/', $oldval );
1382
  $value = $value.'/'.$temp[1];
1383
  $item = 'upload_limit';
1384
  $itemname = __( 'Upload limit count' , 'wp-photo-album-plus');
1385
  break;
1386
  case 'upload_limit_time':
1387
- $oldval = $wpdb->get_var( $wpdb->prepare( 'SELECT `upload_limit` FROM '.WPPA_ALBUMS.' WHERE `id` = %s', $album ) );
 
1388
  $temp = explode( '/', $oldval );
1389
  $value = $temp[0].'/'.$value;
1390
  $item = 'upload_limit';
@@ -1410,7 +1438,7 @@ global $wppa_log_file;
1410
  case 'min':
1411
  $itemname = __( 'Schedule date/time' , 'wp-photo-album-plus');
1412
  $scheduledtm = $wpdb->get_var( $wpdb->prepare( "SELECT scheduledtm
1413
- FROM {$wpdb->prefix}wppa_albums
1414
  WHERE id = %d", $album ) );
1415
  if ( ! $scheduledtm ) {
1416
  $scheduledtm = wppa_get_default_scheduledtm();
@@ -1429,10 +1457,10 @@ global $wppa_log_file;
1429
 
1430
  case 'setallscheduled':
1431
  $scheduledtm = $wpdb->get_var( $wpdb->prepare( "SELECT scheduledtm
1432
- FROM {$wpdb->prefix}wppa_albums
1433
  WHERE id = %d", $album ) );
1434
  if ( $scheduledtm ) {
1435
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos
1436
  SET status = 'scheduled', scheduledtm = %s
1437
  WHERE album = %d", $scheduledtm, $album ) );
1438
  echo '||0||'.__( 'All photos set to scheduled per date', 'wp-photo-album-plus' ) . ' ' . wppa_format_scheduledtm( $scheduledtm );
@@ -1470,7 +1498,7 @@ global $wppa_log_file;
1470
  $itemname = $item;
1471
  }
1472
 
1473
- $query = $wpdb->prepare( 'UPDATE '.WPPA_ALBUMS.' SET `'.$item.'` = %s WHERE `id` = %s', $value, $album );
1474
  $iret = $wpdb->query( $query );
1475
  if ( $iret !== false ) {
1476
  if ( $item == 'name' || $item == 'description' || $item == 'cats' ) {
@@ -1507,7 +1535,7 @@ global $wppa_log_file;
1507
  wppa_exit(); // Nonce check failed
1508
  }
1509
 
1510
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_COMMENTS.'` SET `status` = %s WHERE `id` = %s', $comstat, $comid ) );
1511
  if ( wppa_switch( 'search_comments' ) ) {
1512
  wppa_update_photo( $photo );
1513
  }
@@ -1637,11 +1665,14 @@ global $wppa_log_file;
1637
  echo '||1||'.__( 'Enter a value > -90 and < 90' , 'wp-photo-album-plus');
1638
  wppa_exit();
1639
  }
1640
- $photodata = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_PHOTOS.' WHERE `id` = %s', $photo ), ARRAY_A );
 
1641
  $geo = $photodata['location'] ? $photodata['location'] : '///';
1642
  $geo = explode( '/', $geo );
1643
  $geo = wppa_format_geo( $value, $geo['3'] );
1644
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `location` = %s WHERE `id` = %s', $geo, $photo ) );
 
 
1645
  if ( $iret ) echo '||0||'.__( 'Lattitude updated' , 'wp-photo-album-plus');
1646
  else {
1647
  echo '||1||'.__( 'Could not update latitude' , 'wp-photo-album-plus');
@@ -1653,11 +1684,14 @@ global $wppa_log_file;
1653
  echo '||1||'.__( 'Enter a value > -180 and < 180' , 'wp-photo-album-plus');
1654
  wppa_exit();
1655
  }
1656
- $photodata = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_PHOTOS.' WHERE `id` = %s', $photo ), ARRAY_A );
 
1657
  $geo = $photodata['location'] ? $photodata['location'] : '///';
1658
  $geo = explode( '/', $geo );
1659
  $geo = wppa_format_geo( $geo['2'], $value );
1660
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `location` = %s WHERE `id` = %s', $geo, $photo ) );
 
 
1661
  if ( $iret ) echo '||0||'.__( 'Longitude updated' , 'wp-photo-album-plus');
1662
  else {
1663
  echo '||1||'.__( 'Could not update longitude' , 'wp-photo-album-plus');
@@ -1941,7 +1975,9 @@ global $wppa_log_file;
1941
  break;
1942
 
1943
  case 'moveto':
1944
- $photodata = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_PHOTOS.' WHERE `id` = %s', $photo ), ARRAY_A );
 
 
1945
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
1946
  $exists = wppa_file_is_in_album( $photodata['filename'], $value );
1947
  if ( $exists ) { // Already exists
@@ -1957,7 +1993,7 @@ global $wppa_log_file;
1957
  }
1958
  wppa_invalidate_treecounts( $photodata['album'] ); // Current album
1959
  wppa_invalidate_treecounts( $value ); // New album
1960
- $iret = wppa_update_photo( array( 'id' => $photo, 'album' => $value ) ); // $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `album` = %s WHERE `id` = %s', $value, $photo ) );
1961
  $edit_link = wppa_ea_url( 'single', $tab = 'edit' ) . '&photo=' . $photodata['id'];
1962
  if ( $iret !== false ) {
1963
  wppa_move_source( $photodata['filename'], $photodata['album'], $value );
@@ -1971,7 +2007,9 @@ global $wppa_log_file;
1971
  break;
1972
 
1973
  case 'copyto':
1974
- $photodata = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_PHOTOS.' WHERE `id` = %s', $photo ), ARRAY_A );
 
 
1975
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
1976
  $exists = wppa_file_is_in_album( $photodata['filename'], $value );
1977
  if ( $exists ) { // Already exists
@@ -2102,7 +2140,9 @@ global $wppa_log_file;
2102
  $itemname = $item;
2103
  }
2104
 
2105
- $iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `'.$item.'` = %s WHERE `id` = %s', $value, $photo ) );
 
 
2106
  if ( $item == 'name' || $item == 'description' || $item == 'tags' ) wppa_index_update( 'photo', $photo );
2107
  if ( $item == 'status' && $value != 'scheduled' ) wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => '' ) );
2108
  if ( $item == 'status' ) wppa_invalidate_treecounts( wppa_get_photo_item( $photo, 'album' ) );
@@ -2378,7 +2418,7 @@ global $wppa_log_file;
2378
 
2379
  if ( substr( $option, 0, 16 ) == 'wppa_iptc_label_' ) {
2380
  $tag = substr( $option, 16 );
2381
- $q = $wpdb->prepare( "UPDATE `".WPPA_IPTC."` SET `description`=%s WHERE `tag`=%s AND `photo`='0'", $value, $tag );
2382
  $bret = $wpdb->query( $q );
2383
  // Produce the response text
2384
  if ( $bret ) {
@@ -2392,7 +2432,7 @@ global $wppa_log_file;
2392
  }
2393
  elseif ( substr( $option, 0, 17 ) == 'wppa_iptc_status_' ) {
2394
  $tag = substr( $option, 17 );
2395
- $q = $wpdb->prepare( "UPDATE `".WPPA_IPTC."` SET `status`=%s WHERE `tag`=%s AND `photo`='0'", $value, $tag );
2396
  $bret = $wpdb->query( $q );
2397
  // Produce the response text
2398
  if ( $bret ) {
@@ -2406,7 +2446,7 @@ global $wppa_log_file;
2406
  }
2407
  elseif ( substr( $option, 0, 16 ) == 'wppa_exif_label_' ) {
2408
  $tag = substr( $option, 16 );
2409
- $q = $wpdb->prepare( "UPDATE `".WPPA_EXIF."` SET `description`=%s WHERE `tag`=%s AND `photo`='0'", $value, $tag );
2410
  $bret = $wpdb->query( $q );
2411
  // Produce the response text
2412
  if ( $bret ) {
@@ -2420,7 +2460,7 @@ global $wppa_log_file;
2420
  }
2421
  elseif ( substr( $option, 0, 17 ) == 'wppa_exif_status_' ) {
2422
  $tag = substr( $option, 17 );
2423
- $q = $wpdb->prepare( "UPDATE `".WPPA_EXIF."` SET `status`=%s WHERE `tag`=%s AND `photo`='0'", $value, $tag );
2424
  $bret = $wpdb->query( $q );
2425
  // Produce the response text
2426
  if ( $bret ) {
@@ -2706,8 +2746,10 @@ global $wppa_log_file;
2706
  break;
2707
 
2708
  case 'wppa_rating_clear':
2709
- $iret1 = $wpdb->query( 'TRUNCATE TABLE '.WPPA_RATING );
2710
- $iret2 = $wpdb->query( 'UPDATE '.WPPA_PHOTOS.' SET mean_rating="0", rating_count="0" WHERE id > -1' );
 
 
2711
  if ( $iret1 !== false && $iret2 !== false ) {
2712
  delete_option( 'wppa_'.WPPA_RATING.'_lastkey' );
2713
  $title = __( 'Ratings cleared' , 'wp-photo-album-plus');
@@ -2732,7 +2774,7 @@ global $wppa_log_file;
2732
  break;
2733
 
2734
  case 'wppa_iptc_clear':
2735
- $iret = $wpdb->query( 'TRUNCATE TABLE '.WPPA_IPTC );
2736
  if ( $iret !== false ) {
2737
  delete_option( 'wppa_'.WPPA_IPTC.'_lastkey' );
2738
  $title = __( 'IPTC data cleared' , 'wp-photo-album-plus');
@@ -2747,7 +2789,7 @@ global $wppa_log_file;
2747
  break;
2748
 
2749
  case 'wppa_exif_clear':
2750
- $iret = $wpdb->query( 'TRUNCATE TABLE '.WPPA_EXIF );
2751
  if ( $iret !== false ) {
2752
  delete_option( 'wppa_'.WPPA_EXIF.'_lastkey' );
2753
  $title = __( 'EXIF data cleared' , 'wp-photo-album-plus');
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 6.9.20
6
  *
7
  */
8
 
84
  break;
85
  case 'getssiptclist':
86
  $tag = str_replace( 'H', '#', $_REQUEST['tag'] );
87
+ $mocc = strval( intval( $_REQUEST['moccur'] ) );
88
  $oldvalue = '';
89
  if ( strpos( $wppa_session['supersearch'], ',' ) !== false ) {
90
  $ss_data = explode( ',', $wppa_session['supersearch'] );
99
  }
100
  }
101
  $iptcdata = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT description
102
+ FROM $wpdb->wppa_iptc
103
  WHERE photo > 0 AND tag = %s
104
  ORDER BY description", $tag ), ARRAY_A );
105
  $last = '';
124
  }
125
  }
126
  if ( ! $any ) {
127
+ $query = $wpdb->prepare( "UPDATE $wpdb->wppa_iptc
128
  SET status = 'hide'
129
  WHERE photo = 0 AND tag = %s", $tag );
130
  $wpdb->query( $query );
162
 
163
  if ( $brand ) {
164
  $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT f_description
165
+ FROM $wpdb->wppa_exif
166
  WHERE photo > 0
167
  AND tag = %s
168
  AND brand = %s
172
  }
173
  else {
174
  $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT DISTINCT f_description
175
+ FROM $wpdb->wppa_exif
176
  WHERE photo > 0
177
  AND tag = %s
178
  AND f_description <> %s
240
 
241
  // Cleanup possible unused label
242
  if ( ! $any ) {
243
+ $query = $wpdb->prepare( "UPDATE $wpdb->wppa_exif
244
  SET status = 'hide'
245
  WHERE photo = 0
246
  AND tag = %s", $tag );
413
  }
414
 
415
  if ( $pid && current_user_can( 'wppa_moderate' ) ) {
416
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
417
  SET status = 'publish'
418
  WHERE id = %d", $pid ) );
419
  wppa_flush_upldr_cache( 'photoid', $pid );
420
+ $alb = $wpdb->get_var( $wpdb->prepare( "SELECT album FROM $wpdb->wppa_photos
421
  WHERE id = %d", $pid ) );
422
  wppa_clear_taglist();
423
  wppa_invalidate_treecounts( $alb );
424
  }
425
 
426
  if ( $cid && current_user_can( 'wppa_moderate' ) ) {
427
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_comments
428
  SET status = 'approved'
429
  WHERE id = %d", $cid ) );
430
  if ( $iret ) {
446
  else {
447
  if ( $pid ) {
448
  if ( current_user_can( 'wppa_moderate' ) ) {
449
+ echo sprintf( __( 'Failed to update stutus of photo %d' , 'wp-photo-album-plus'), $pid )."\n".__( 'Please refresh the page', 'wp-photo-album-plus' );
450
  }
451
  else {
452
  _e( 'Security check failure' , 'wp-photo-album-plus');
453
  }
454
  }
455
  if ( $cid ) {
456
+ echo sprintf( __( 'Failed to update stutus of comment %d' , 'wp-photo-album-plus'), $cid )."\n".__( 'Please refresh the page', 'wp-photo-album-plus' );
457
  }
458
  }
459
  wppa_exit();
466
  // Remove photo
467
  if ( $pid ) {
468
  if ( wppa_may_user_fe_delete( $pid ) ) {
469
+
470
  wppa_delete_photo( $pid );
471
  echo 'OK||' . __( 'Photo removed', 'wp-photo-album-plus' );
472
  wppa_exit();
482
  wppa_exit();
483
  }
484
 
485
+ $photo = $wpdb->get_var( $wpdb->prepare( "SELECT photo FROM $wpdb->wppa_comments
486
  WHERE id = %d", $cid ) );
487
 
488
+ $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_comments
489
  WHERE id = %d", $cid ) );
490
 
491
  if ( $iret ) {
516
  $alb = wppa_decrypt_album( $_REQUEST['album-id'] );
517
 
518
  if ( is_user_logged_in() ) {
519
+ $query = "SELECT * FROM $wpdb->wppa_photos
520
  WHERE album = %d
521
  AND ( ( status <> 'pending'
522
  AND status <> 'scheduled' )
523
  OR owner = %s )";
524
  }
525
  else {
526
+ $query = "SELECT * FROM $wpdb->wppa_photos
527
  WHERE album = %d
528
  AND ( ( status <> 'pending'
529
  AND status <> 'scheduled'
634
  $zipfile = $zipsdir.wppa_get_user().'.zip';
635
 
636
  // Find the photo data
637
+ $data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
638
  WHERE id = %d", $photo ), ARRAY_A );
639
 
640
  // Find the photo file
688
  wppa_exit();
689
  }
690
 
691
+ $data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
692
  WHERE id = %s", $photo ), ARRAY_A );
693
 
694
  if ( $data ) { // The photo is supposed to exist
889
  }
890
 
891
  // Already a pending one?
892
+ $pending = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_rating
893
  WHERE photo = %d
894
  AND user = %s
895
  AND status = 'pending'", $photo, $user ) );
896
 
897
  // Has user motivated his vote?
898
+ $hascommented = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments
899
  WHERE photo = %d
900
  AND user = %s", $photo, wppa_get_user( 'display' ) ) );
901
 
905
  wppa_exit();
906
  }
907
  else {
908
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_rating
909
  SET status = 'publish'
910
  WHERE photo = %d
911
  AND user = %s", $photo, $user ) );
931
  if ( $mylast ) {
932
 
933
  // Remove my like
934
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_rating
935
  WHERE photo = %d
936
  AND user = %s", $photo, $user ) );
937
  $myavgrat = '0';
1016
 
1017
  // Case 3: I will change my previously given vote
1018
  elseif ( wppa_switch( 'rating_change' ) ) { // Votechanging is allowed
1019
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_rating
1020
  SET value = %s
1021
  WHERE photo = %d
1022
  AND user = %s
1043
  }
1044
 
1045
  // Compute my avg rating
1046
+ $myrats = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
1047
  WHERE photo = %d
1048
  AND user = %s
1049
  AND status = 'publish'", $photo, $user ), ARRAY_A );
1070
  }
1071
  /*hbi*/
1072
  // Compute new allavgrat
1073
+ $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
1074
+ WHERE photo = %d
1075
+ AND status = %s", $photo, 'publish' ), ARRAY_A );
1076
  if ( $ratings ) {
1077
  $sum = 0;
1078
  $cnt = 0;
1091
  else $allavgrat = '0';
1092
 
1093
  // Store it in the photo info
1094
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1095
+ SET mean_rating = %s
1096
+ WHERE id = %d", $allavgrat, $photo ) );
1097
  if ( $iret === false ) {
1098
  echo '0||106||'.$wartxt;
1099
  wppa_exit(); // Fail on save
1100
  }
1101
 
1102
  // Compute rating_count and store in the photo info
1103
+ $ratcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_rating
1104
+ WHERE photo = %d", $photo ) );
1105
  if ( $ratcount !== false ) {
1106
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1107
+ SET rating_count = %d WHERE id = %d", $ratcount, $photo ) );
1108
  if ( $iret === false ) {
1109
  echo '0||107||'.$wartxt;
1110
  wppa_exit(); // Fail on save
1115
  $allavgratcombi = $allavgrat.'|'.$ratcount;
1116
 
1117
  // Compute dsilike count
1118
+ $discount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_rating
1119
+ WHERE photo = %d
1120
+ AND value = -1
1121
+ AND status = 'publish'", $photo ) );
1122
  if ( $discount === false ) {
1123
  echo '0||108||'.$wartxt;
1124
  wppa_exit(); // Fail on save
1188
  echo '||0||'.__( 'Security check failure' , 'wp-photo-album-plus');
1189
  wppa_exit(); // Nonce check failed
1190
  }
1191
+ $album = $wpdb->get_var( $wpdb->prepare( "SELECT album FROM $wpdb->wppa_photos
1192
+ WHERE id = %d", $photo ) );
1193
  wppa_delete_photo( $photo );
1194
  wppa_clear_cache();
1195
  $edit_link = wppa_ea_url( 'single', $tab = 'edit' ) . '&photo=' . $photo;
1213
  echo '||0||'.__( 'Security check failure' , 'wp-photo-album-plus');
1214
  wppa_exit(); // Nonce check failed
1215
  }
1216
+ $album = $wpdb->get_var( $wpdb->prepare( "SELECT album FROM $wpdb->wppa_photos
1217
+ WHERE id = %d", $photo ) );
1218
  if ( wppa_is_int( $album ) && $album < '-9' ) {
1219
  wppa_update_photo( array( 'id' => $photo, 'album' => - ( $album + '9' ) ) );
1220
  wppa_invalidate_treecounts( - ( $album + '9' ) );
1241
 
1242
  switch ( $item ) {
1243
  case 'clear_ratings':
1244
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1245
+ WHERE album = %d", $album ), ARRAY_A );
1246
  if ( $photos ) foreach ( $photos as $photo ) {
1247
+ $iret1 = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_rating WHERE photo = %d", $photo['id'] ) );
1248
+ $iret2 = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1249
+ SET mean_rating = '' WHERE id = %d", $photo['id'] ) );
1250
  }
1251
  if ( $photos && $iret1 !== false && $iret2 !== false ) {
1252
  echo '||0||'.__( 'Ratings cleared' , 'wp-photo-album-plus').'||'.__( 'No ratings for this photo.' , 'wp-photo-album-plus');
1260
  wppa_exit();
1261
  break;
1262
  case 'set_deftags': // to be changed for large albums
1263
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1264
+ WHERE album = %d", $album ), ARRAY_A );
1265
+
1266
+ $deftag = $wpdb->get_var( $wpdb->prepare( "SELECT default_tags FROM $wpdb->wppa_albums
1267
+ WHERE id = %d", $album ) );
1268
+
1269
  if ( is_array( $photos ) ) foreach ( $photos as $photo ) {
1270
 
1271
  $tags = wppa_sanitize_tags( wppa_filter_iptc( wppa_filter_exif( $deftag, $photo['id'] ), $photo['id'] ) );
1272
 
1273
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1274
+ SET tags = %s
1275
+ WHERE id = %d", $tags, $photo['id'] ) );
1276
  wppa_index_update( 'photo', $photo['id'] );
1277
  }
1278
  if ( $photos && $iret !== false ) {
1288
  wppa_exit();
1289
  break;
1290
  case 'add_deftags':
1291
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1292
+ WHERE album = %d", $album ), ARRAY_A );
1293
+
1294
+ $deftag = $wpdb->get_var( $wpdb->prepare( "SELECT default_tags FROM $wpdb->wppa_albums
1295
+ WHERE id = %d", $album ) );
1296
+
1297
  if ( is_array( $photos ) ) foreach ( $photos as $photo ) {
1298
 
1299
  $tags = wppa_sanitize_tags( wppa_filter_iptc( wppa_filter_exif( $photo['tags'].','.$deftag, $photo['id'] ), $photo['id'] ) );
1300
 
1301
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1302
+ SET tags = %s
1303
+ WHERE id = %d", $tags, $photo['id'] ) );
1304
  wppa_index_update( 'photo', $photo['id'] );
1305
  }
1306
  if ( $photos && $iret !== false ) {
1403
  case 'upload_limit_count':
1404
  wppa_ajax_check_range( $value, false, '0', false, __( 'Upload limit count' , 'wp-photo-album-plus') );
1405
  if ( wppa( 'error' ) ) wppa_exit();
1406
+ $oldval = $wpdb->get_var( $wpdb->prepare( "SELECT upload_limit FROM $wpdb->wppa_albums
1407
+ WHERE id = %d", $album ) );
1408
  $temp = explode( '/', $oldval );
1409
  $value = $value.'/'.$temp[1];
1410
  $item = 'upload_limit';
1411
  $itemname = __( 'Upload limit count' , 'wp-photo-album-plus');
1412
  break;
1413
  case 'upload_limit_time':
1414
+ $oldval = $wpdb->get_var( $wpdb->prepare( "SELECT upload_limit FROM $wpdb->wppa_albums
1415
+ WHERE id = %d", $album ) );
1416
  $temp = explode( '/', $oldval );
1417
  $value = $temp[0].'/'.$value;
1418
  $item = 'upload_limit';
1438
  case 'min':
1439
  $itemname = __( 'Schedule date/time' , 'wp-photo-album-plus');
1440
  $scheduledtm = $wpdb->get_var( $wpdb->prepare( "SELECT scheduledtm
1441
+ FROM $wpdb->wppa_albums
1442
  WHERE id = %d", $album ) );
1443
  if ( ! $scheduledtm ) {
1444
  $scheduledtm = wppa_get_default_scheduledtm();
1457
 
1458
  case 'setallscheduled':
1459
  $scheduledtm = $wpdb->get_var( $wpdb->prepare( "SELECT scheduledtm
1460
+ FROM $wpdb->wppa_albums
1461
  WHERE id = %d", $album ) );
1462
  if ( $scheduledtm ) {
1463
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1464
  SET status = 'scheduled', scheduledtm = %s
1465
  WHERE album = %d", $scheduledtm, $album ) );
1466
  echo '||0||'.__( 'All photos set to scheduled per date', 'wp-photo-album-plus' ) . ' ' . wppa_format_scheduledtm( $scheduledtm );
1498
  $itemname = $item;
1499
  }
1500
 
1501
+ $query = $wpdb->prepare( "UPDATE $wpdb->wppa_albums SET $item = %s WHERE id = %d", $value, $album );
1502
  $iret = $wpdb->query( $query );
1503
  if ( $iret !== false ) {
1504
  if ( $item == 'name' || $item == 'description' || $item == 'cats' ) {
1535
  wppa_exit(); // Nonce check failed
1536
  }
1537
 
1538
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_comments SET status = %s WHERE id = %d", $comstat, $comid ) );
1539
  if ( wppa_switch( 'search_comments' ) ) {
1540
  wppa_update_photo( $photo );
1541
  }
1665
  echo '||1||'.__( 'Enter a value > -90 and < 90' , 'wp-photo-album-plus');
1666
  wppa_exit();
1667
  }
1668
+ $photodata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1669
+ WHERE id = %d", $photo ), ARRAY_A );
1670
  $geo = $photodata['location'] ? $photodata['location'] : '///';
1671
  $geo = explode( '/', $geo );
1672
  $geo = wppa_format_geo( $value, $geo['3'] );
1673
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1674
+ SET location = %s
1675
+ WHERE id = %d", $geo, $photo ) );
1676
  if ( $iret ) echo '||0||'.__( 'Lattitude updated' , 'wp-photo-album-plus');
1677
  else {
1678
  echo '||1||'.__( 'Could not update latitude' , 'wp-photo-album-plus');
1684
  echo '||1||'.__( 'Enter a value > -180 and < 180' , 'wp-photo-album-plus');
1685
  wppa_exit();
1686
  }
1687
+ $photodata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1688
+ WHERE id = %d", $photo ), ARRAY_A );
1689
  $geo = $photodata['location'] ? $photodata['location'] : '///';
1690
  $geo = explode( '/', $geo );
1691
  $geo = wppa_format_geo( $geo['2'], $value );
1692
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
1693
+ SET location = %s
1694
+ WHERE id = %d", $geo, $photo ) );
1695
  if ( $iret ) echo '||0||'.__( 'Longitude updated' , 'wp-photo-album-plus');
1696
  else {
1697
  echo '||1||'.__( 'Could not update longitude' , 'wp-photo-album-plus');
1975
  break;
1976
 
1977
  case 'moveto':
1978
+ $photodata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1979
+ WHERE id = %d", $photo ), ARRAY_A );
1980
+
1981
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
1982
  $exists = wppa_file_is_in_album( $photodata['filename'], $value );
1983
  if ( $exists ) { // Already exists
1993
  }
1994
  wppa_invalidate_treecounts( $photodata['album'] ); // Current album
1995
  wppa_invalidate_treecounts( $value ); // New album
1996
+ $iret = wppa_update_photo( array( 'id' => $photo, 'album' => $value ) );
1997
  $edit_link = wppa_ea_url( 'single', $tab = 'edit' ) . '&photo=' . $photodata['id'];
1998
  if ( $iret !== false ) {
1999
  wppa_move_source( $photodata['filename'], $photodata['album'], $value );
2007
  break;
2008
 
2009
  case 'copyto':
2010
+ $photodata = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
2011
+ WHERE id = %d", $photo ), ARRAY_A );
2012
+
2013
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2014
  $exists = wppa_file_is_in_album( $photodata['filename'], $value );
2015
  if ( $exists ) { // Already exists
2140
  $itemname = $item;
2141
  }
2142
 
2143
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
2144
+ SET $item = %s WHERE id = %d", $value, $photo ) );
2145
+
2146
  if ( $item == 'name' || $item == 'description' || $item == 'tags' ) wppa_index_update( 'photo', $photo );
2147
  if ( $item == 'status' && $value != 'scheduled' ) wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => '' ) );
2148
  if ( $item == 'status' ) wppa_invalidate_treecounts( wppa_get_photo_item( $photo, 'album' ) );
2418
 
2419
  if ( substr( $option, 0, 16 ) == 'wppa_iptc_label_' ) {
2420
  $tag = substr( $option, 16 );
2421
+ $q = $wpdb->prepare( "UPDATE $wpdb->wppa_iptc SET description = %s WHERE tag = %s AND photo = '0'", $value, $tag );
2422
  $bret = $wpdb->query( $q );
2423
  // Produce the response text
2424
  if ( $bret ) {
2432
  }
2433
  elseif ( substr( $option, 0, 17 ) == 'wppa_iptc_status_' ) {
2434
  $tag = substr( $option, 17 );
2435
+ $q = $wpdb->prepare( "UPDATE $wpdb->wppa_iptc SET status = %s WHERE tag = %s AND photo = '0'", $value, $tag );
2436
  $bret = $wpdb->query( $q );
2437
  // Produce the response text
2438
  if ( $bret ) {
2446
  }
2447
  elseif ( substr( $option, 0, 16 ) == 'wppa_exif_label_' ) {
2448
  $tag = substr( $option, 16 );
2449
+ $q = $wpdb->prepare( "UPDATE $wpdb->wppa_exif SET description = %s WHERE tag = %s AND photo = '0'", $value, $tag );
2450
  $bret = $wpdb->query( $q );
2451
  // Produce the response text
2452
  if ( $bret ) {
2460
  }
2461
  elseif ( substr( $option, 0, 17 ) == 'wppa_exif_status_' ) {
2462
  $tag = substr( $option, 17 );
2463
+ $q = $wpdb->prepare( "UPDATE $wpdb->wppa_exif SET status = %s WHERE tag = %s AND photo = '0'", $value, $tag );
2464
  $bret = $wpdb->query( $q );
2465
  // Produce the response text
2466
  if ( $bret ) {
2746
  break;
2747
 
2748
  case 'wppa_rating_clear':
2749
+ $iret1 = $wpdb->query( "TRUNCATE TABLE $wpdb->wppa_rating" );
2750
+ $iret2 = $wpdb->query( "UPDATE $wpdb->wppa_photos
2751
+ SET mean_rating = '0', rating_count = '0'" );
2752
+
2753
  if ( $iret1 !== false && $iret2 !== false ) {
2754
  delete_option( 'wppa_'.WPPA_RATING.'_lastkey' );
2755
  $title = __( 'Ratings cleared' , 'wp-photo-album-plus');
2774
  break;
2775
 
2776
  case 'wppa_iptc_clear':
2777
+ $iret = $wpdb->query( "TRUNCATE TABLE $wpdb->wppa_iptc" );
2778
  if ( $iret !== false ) {
2779
  delete_option( 'wppa_'.WPPA_IPTC.'_lastkey' );
2780
  $title = __( 'IPTC data cleared' , 'wp-photo-album-plus');
2789
  break;
2790
 
2791
  case 'wppa_exif_clear':
2792
+ $iret = $wpdb->query( "TRUNCATE TABLE $wpdb->wppa_exif" );
2793
  if ( $iret !== false ) {
2794
  delete_option( 'wppa_'.WPPA_EXIF.'_lastkey' );
2795
  $title = __( 'EXIF data cleared' , 'wp-photo-album-plus');
wppa-album-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
- * Version 6.9.17
7
  *
8
  */
9
 
@@ -25,7 +25,7 @@ global $wppa_revno;
25
  ';
26
 
27
  // Delete trashed comments
28
- $wpdb->query( "DELETE FROM {$wpdb->prefix}wppa_comments WHERE status = 'trash'" );
29
 
30
  $sel = 'selected="selected"';
31
 
@@ -39,14 +39,14 @@ global $wppa_revno;
39
  }
40
 
41
  // Get all albums and cache them
42
- $albs = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wppa_albums", ARRAY_A );
43
  wppa_cache_album( 'add', $albs );
44
 
45
  // Fix orphan albums and deleted target pages
46
  if ( $albs ) {
47
  foreach ( $albs as $alb ) {
48
  if ( $alb['a_parent'] > '0' && wppa_get_parentalbumid( $alb['a_parent'] ) <= '-9' ) { // Parent died?
49
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_albums
50
  SET a_parent = -1
51
  WHERE id = %d", $alb['id'] ) );
52
  }
@@ -58,7 +58,7 @@ global $wppa_revno;
58
  AND post_status = 'publish'", $alb['cover_linkpage'] ) );
59
 
60
  if ( ! $iret ) { // Page gone?
61
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_albums
62
  SET cover_linkpage = 0
63
  WHERE id = %d", $alb['id'] ) );
64
  }
@@ -183,7 +183,7 @@ global $wppa_revno;
183
  }
184
  $name = wppa_get_album_name( $parent ) . '-#' . $id;
185
  if ( ! current_user_can( 'administrator' ) ) { // someone creating an album for someone else?
186
- $parentowner = $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM {$wpdb->prefix}wppa_albums WHERE id = %s", $parent ) );
187
  if ( $parentowner !== wppa_get_user() ) {
188
  wp_die( __( 'You are not allowed to create an album for someone else', 'wp-photo-album-plus' ) );
189
  }
@@ -195,7 +195,7 @@ global $wppa_revno;
195
  $parent = wppa_opt( 'default_parent' );
196
 
197
  // Default parent still exists?
198
- if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_albums WHERE id = %s", $parent ) ) ) {
199
  wppa_update_option( 'wppa_default_parent', '0' );
200
  $parent = '0';
201
  }
@@ -227,7 +227,7 @@ global $wppa_revno;
227
  }
228
 
229
  // See if this user may edit this album
230
- $album_owner = $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM {$wpdb->prefix}wppa_albums WHERE id = %s", $edit_id ) );
231
  if ( ( $album_owner == '--- public ---' && ! current_user_can( 'wppa_admin' ) ) || ! wppa_have_access( $edit_id ) ) {
232
  wp_die( __( 'You have insufficient rights to edit this album', 'wp-photo-album-plus' ) );
233
  }
@@ -237,7 +237,7 @@ global $wppa_revno;
237
  if ( ! wp_verify_nonce( $_REQUEST['wppa_nonce'], 'wppa_nonce') ) {
238
  wp_die( __( 'You do not have the rights to do this', 'wp-photo-album-plus' ) );
239
  }
240
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos
241
  SET description = %s
242
  WHERE album = %d", wppa_opt( 'newphoto_description' ), $edit_id ) );
243
  wppa_ok_message( sprintf( __( '%d photo descriptions updated', 'wp-photo-album-plus' ), $iret ) );
@@ -270,7 +270,7 @@ global $wppa_revno;
270
  }
271
 
272
  // Get the album information
273
- $albuminfo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_albums
274
  WHERE id = %s", $edit_id ), ARRAY_A );
275
 
276
  // We may not use extract(), so we do something like it here manually, hence controlled.
@@ -942,7 +942,7 @@ global $wppa_revno;
942
  ' . __( 'Link to:', 'wp-photo-album-plus' ) . '
943
  </td>
944
  <td>';
945
- $query = "SELECT ID, post_title FROM {$wpdb->prefix}posts
946
  WHERE post_type = 'page'
947
  AND post_status = 'publish'
948
  ORDER BY post_title ASC";
@@ -1292,7 +1292,7 @@ global $wppa_revno;
1292
  <?php echo wppa_album_select_a( array( 'checkaccess' => true,
1293
  'path' => wppa_switch( 'hier_albsel'),
1294
  'selected' => '0',
1295
- 'exclude' => $_REQUEST['edit_id'],
1296
  'addpleaseselect' => true,
1297
  'sort' => true,
1298
  ) )
@@ -1300,7 +1300,7 @@ global $wppa_revno;
1300
  </select>
1301
  </p>
1302
 
1303
- <input type="hidden" name="wppa-del-id" value="<?php echo($_REQUEST['edit_id']) ?>" />
1304
  <input type="button" class="button-primary" value="<?php _e('Cancel', 'wp-photo-album-plus'); ?>" onclick="parent.history.back()" />
1305
  <input type="submit" class="button-primary" style="color: red" name="wppa-del-confirm" value="<?php _e('Delete', 'wp-photo-album-plus'); ?>" />
1306
  </form>
@@ -1444,47 +1444,47 @@ global $wpdb;
1444
  $order_by = get_option( 'wppa_album_order_' . wppa_get_user(), 'id' );
1445
  $order_desc = get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' );
1446
  // A dynamic query is regarded as being insecure, so we make a switch statemnent with all possible sequences.
1447
- // $albums = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY " . $order_by . ( $order_desc == 'yes' ? " DESC" : "" ) , ARRAY_A );
1448
  if ( $order_desc == 'yes' ) {
1449
  switch( $order_by ) {
1450
  case 'name':
1451
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY name DESC";
1452
  break;
1453
  case 'description':
1454
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY description DESC";
1455
  break;
1456
  case 'owner':
1457
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY owner DESC";
1458
  break;
1459
  case 'a_order':
1460
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_order DESC";
1461
  break;
1462
  case 'a_parent':
1463
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_parent DESC";
1464
  break;
1465
  default:
1466
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY id DESC";
1467
  }
1468
  }
1469
  else {
1470
  switch( $order_by ) {
1471
  case 'name':
1472
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY name";
1473
  break;
1474
  case 'description':
1475
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY description";
1476
  break;
1477
  case 'owner':
1478
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY owner";
1479
  break;
1480
  case 'a_order':
1481
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_order";
1482
  break;
1483
  case 'a_parent':
1484
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_parent";
1485
  break;
1486
  default:
1487
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY id";
1488
  }
1489
  }
1490
  $albums = $wpdb->get_results( $query, ARRAY_A );
@@ -1862,43 +1862,43 @@ global $wpdb;
1862
  if ( $order_desc == 'yes' ) {
1863
  switch( $order_by ) {
1864
  case 'name':
1865
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY name DESC";
1866
  break;
1867
  case 'description':
1868
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY description DESC";
1869
  break;
1870
  case 'owner':
1871
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY owner DESC";
1872
  break;
1873
  case 'a_order':
1874
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_order DESC";
1875
  break;
1876
  case 'a_parent':
1877
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_parent DESC";
1878
  break;
1879
  default:
1880
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY id DESC";
1881
  }
1882
  }
1883
  else {
1884
  switch( $order_by ) {
1885
  case 'name':
1886
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY name";
1887
  break;
1888
  case 'description':
1889
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY description";
1890
  break;
1891
  case 'owner':
1892
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY owner";
1893
  break;
1894
  case 'a_order':
1895
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_order";
1896
  break;
1897
  case 'a_parent':
1898
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY a_parent";
1899
  break;
1900
  default:
1901
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums ORDER BY id";
1902
  }
1903
  }
1904
  $albums = $wpdb->get_results( $query, ARRAY_A );
@@ -1945,7 +1945,7 @@ global $wpdb;
1945
  $done = false;
1946
 
1947
  // Add missing parent
1948
- $albums[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE id = %d", $parent ), ARRAY_A );
1949
  }
1950
  }
1951
  }
@@ -2531,7 +2531,7 @@ global $wpdb;
2531
  function wppa_have_accessible_children( $alb ) {
2532
  global $wpdb;
2533
 
2534
- $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d", $alb['id'] ), ARRAY_A );
2535
 
2536
  if ( ! $albums || ! count( $albums ) ) return false;
2537
  foreach ( $albums as $album ) {
@@ -2554,11 +2554,11 @@ global $wpdb;
2554
  }
2555
 
2556
  // Photos in the album
2557
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos WHERE album = %s", $id ), ARRAY_A );
2558
 
2559
  if ( is_array( $photos ) ) {
2560
  foreach ( $photos as $photo ) {
2561
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos SET album = %s WHERE id = %d", $move, $photo['id'] ) );
2562
 
2563
  // Move to trash?
2564
  if ( $move > '0' ) {
@@ -2580,7 +2580,7 @@ global $wpdb;
2580
  wppa_invalidate_treecounts( $id );
2581
 
2582
  // Now delete the album
2583
- $wpdb->query( $wpdb->prepare( "DELETE FROM {$wpdb->prefix}wppa_albums WHERE id = %d", $id ) );
2584
  wppa_delete_album_source( $id );
2585
  wppa_index_remove( 'album', $id );
2586
  wppa_clear_catlist();
@@ -2599,7 +2599,7 @@ global $wpdb;
2599
  function wppa_main_photo($cur = '', $covertype) {
2600
  global $wpdb;
2601
 
2602
- $a_id = $_REQUEST['edit_id'];
2603
  $photos = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->wppa_photos WHERE `album` = %s " . wppa_get_photo_order( $a_id ) . " LIMIT 1000", $a_id ), ARRAY_A );
2604
 
2605
  $output = '';
@@ -2664,7 +2664,7 @@ global $wpdb;
2664
  // If random...
2665
  if ( $albumorder_col == 'random' ) {
2666
 
2667
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %s ORDER BY RAND(%d)";
2668
 
2669
  $albums = $wpdb->get_results( $wpdb->prepare( $query, $parent, wppa_get_randseed() ), ARRAY_A );
2670
  }
@@ -2675,16 +2675,16 @@ global $wpdb;
2675
  switch ( $albumorder_col ) {
2676
 
2677
  case 'a_order':
2678
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY a_order DESC";
2679
  break;
2680
  case 'name':
2681
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY name DESC";
2682
  break;
2683
  case 'timestamp':
2684
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY timestamp DESC";
2685
  break;
2686
  default:
2687
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY id DESC";
2688
 
2689
  }
2690
  }
@@ -2695,16 +2695,16 @@ global $wpdb;
2695
  switch ( $albumorder_col ) {
2696
 
2697
  case 'a_order':
2698
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY a_order";
2699
  break;
2700
  case 'name':
2701
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY name";
2702
  break;
2703
  case 'timestamp':
2704
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY timestamp";
2705
  break;
2706
  default:
2707
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY id";
2708
 
2709
  }
2710
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 6.9.20
7
  *
8
  */
9
 
25
  ';
26
 
27
  // Delete trashed comments
28
+ $wpdb->query( "DELETE FROM $wpdb->wppa_comments WHERE status = 'trash'" );
29
 
30
  $sel = 'selected="selected"';
31
 
39
  }
40
 
41
  // Get all albums and cache them
42
+ $albs = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums", ARRAY_A );
43
  wppa_cache_album( 'add', $albs );
44
 
45
  // Fix orphan albums and deleted target pages
46
  if ( $albs ) {
47
  foreach ( $albs as $alb ) {
48
  if ( $alb['a_parent'] > '0' && wppa_get_parentalbumid( $alb['a_parent'] ) <= '-9' ) { // Parent died?
49
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_albums
50
  SET a_parent = -1
51
  WHERE id = %d", $alb['id'] ) );
52
  }
58
  AND post_status = 'publish'", $alb['cover_linkpage'] ) );
59
 
60
  if ( ! $iret ) { // Page gone?
61
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_albums
62
  SET cover_linkpage = 0
63
  WHERE id = %d", $alb['id'] ) );
64
  }
183
  }
184
  $name = wppa_get_album_name( $parent ) . '-#' . $id;
185
  if ( ! current_user_can( 'administrator' ) ) { // someone creating an album for someone else?
186
+ $parentowner = $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_albums WHERE id = %s", $parent ) );
187
  if ( $parentowner !== wppa_get_user() ) {
188
  wp_die( __( 'You are not allowed to create an album for someone else', 'wp-photo-album-plus' ) );
189
  }
195
  $parent = wppa_opt( 'default_parent' );
196
 
197
  // Default parent still exists?
198
+ if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE id = %s", $parent ) ) ) {
199
  wppa_update_option( 'wppa_default_parent', '0' );
200
  $parent = '0';
201
  }
227
  }
228
 
229
  // See if this user may edit this album
230
+ $album_owner = $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_albums WHERE id = %s", $edit_id ) );
231
  if ( ( $album_owner == '--- public ---' && ! current_user_can( 'wppa_admin' ) ) || ! wppa_have_access( $edit_id ) ) {
232
  wp_die( __( 'You have insufficient rights to edit this album', 'wp-photo-album-plus' ) );
233
  }
237
  if ( ! wp_verify_nonce( $_REQUEST['wppa_nonce'], 'wppa_nonce') ) {
238
  wp_die( __( 'You do not have the rights to do this', 'wp-photo-album-plus' ) );
239
  }
240
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
241
  SET description = %s
242
  WHERE album = %d", wppa_opt( 'newphoto_description' ), $edit_id ) );
243
  wppa_ok_message( sprintf( __( '%d photo descriptions updated', 'wp-photo-album-plus' ), $iret ) );
270
  }
271
 
272
  // Get the album information
273
+ $albuminfo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
274
  WHERE id = %s", $edit_id ), ARRAY_A );
275
 
276
  // We may not use extract(), so we do something like it here manually, hence controlled.
942
  ' . __( 'Link to:', 'wp-photo-album-plus' ) . '
943
  </td>
944
  <td>';
945
+ $query = "SELECT ID, post_title FROM $wpdb->posts
946
  WHERE post_type = 'page'
947
  AND post_status = 'publish'
948
  ORDER BY post_title ASC";
1292
  <?php echo wppa_album_select_a( array( 'checkaccess' => true,
1293
  'path' => wppa_switch( 'hier_albsel'),
1294
  'selected' => '0',
1295
+ 'exclude' => strval( intval( $_REQUEST['edit_id'] ) ),
1296
  'addpleaseselect' => true,
1297
  'sort' => true,
1298
  ) )
1300
  </select>
1301
  </p>
1302
 
1303
+ <input type="hidden" name="wppa-del-id" value="<?php echo strval( intval( $_REQUEST['edit_id'] ) ) ?>" />
1304
  <input type="button" class="button-primary" value="<?php _e('Cancel', 'wp-photo-album-plus'); ?>" onclick="parent.history.back()" />
1305
  <input type="submit" class="button-primary" style="color: red" name="wppa-del-confirm" value="<?php _e('Delete', 'wp-photo-album-plus'); ?>" />
1306
  </form>
1444
  $order_by = get_option( 'wppa_album_order_' . wppa_get_user(), 'id' );
1445
  $order_desc = get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' );
1446
  // A dynamic query is regarded as being insecure, so we make a switch statemnent with all possible sequences.
1447
+ // $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums ORDER BY " . $order_by . ( $order_desc == 'yes' ? " DESC" : "" ) , ARRAY_A );
1448
  if ( $order_desc == 'yes' ) {
1449
  switch( $order_by ) {
1450
  case 'name':
1451
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY name DESC";
1452
  break;
1453
  case 'description':
1454
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY description DESC";
1455
  break;
1456
  case 'owner':
1457
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY owner DESC";
1458
  break;
1459
  case 'a_order':
1460
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_order DESC";
1461
  break;
1462
  case 'a_parent':
1463
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_parent DESC";
1464
  break;
1465
  default:
1466
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY id DESC";
1467
  }
1468
  }
1469
  else {
1470
  switch( $order_by ) {
1471
  case 'name':
1472
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY name";
1473
  break;
1474
  case 'description':
1475
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY description";
1476
  break;
1477
  case 'owner':
1478
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY owner";
1479
  break;
1480
  case 'a_order':
1481
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_order";
1482
  break;
1483
  case 'a_parent':
1484
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_parent";
1485
  break;
1486
  default:
1487
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY id";
1488
  }
1489
  }
1490
  $albums = $wpdb->get_results( $query, ARRAY_A );
1862
  if ( $order_desc == 'yes' ) {
1863
  switch( $order_by ) {
1864
  case 'name':
1865
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY name DESC";
1866
  break;
1867
  case 'description':
1868
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY description DESC";
1869
  break;
1870
  case 'owner':
1871
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY owner DESC";
1872
  break;
1873
  case 'a_order':
1874
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_order DESC";
1875
  break;
1876
  case 'a_parent':
1877
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_parent DESC";
1878
  break;
1879
  default:
1880
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY id DESC";
1881
  }
1882
  }
1883
  else {
1884
  switch( $order_by ) {
1885
  case 'name':
1886
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY name";
1887
  break;
1888
  case 'description':
1889
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY description";
1890
  break;
1891
  case 'owner':
1892
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY owner";
1893
  break;
1894
  case 'a_order':
1895
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_order";
1896
  break;
1897
  case 'a_parent':
1898
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY a_parent";
1899
  break;
1900
  default:
1901
+ $query = "SELECT * FROM $wpdb->wppa_albums ORDER BY id";
1902
  }
1903
  }
1904
  $albums = $wpdb->get_results( $query, ARRAY_A );
1945
  $done = false;
1946
 
1947
  // Add missing parent
1948
+ $albums[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id = %d", $parent ), ARRAY_A );
1949
  }
1950
  }
1951
  }
2531
  function wppa_have_accessible_children( $alb ) {
2532
  global $wpdb;
2533
 
2534
+ $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d", $alb['id'] ), ARRAY_A );
2535
 
2536
  if ( ! $albums || ! count( $albums ) ) return false;
2537
  foreach ( $albums as $album ) {
2554
  }
2555
 
2556
  // Photos in the album
2557
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE album = %s", $id ), ARRAY_A );
2558
 
2559
  if ( is_array( $photos ) ) {
2560
  foreach ( $photos as $photo ) {
2561
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos SET album = %s WHERE id = %d", $move, $photo['id'] ) );
2562
 
2563
  // Move to trash?
2564
  if ( $move > '0' ) {
2580
  wppa_invalidate_treecounts( $id );
2581
 
2582
  // Now delete the album
2583
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_albums WHERE id = %d", $id ) );
2584
  wppa_delete_album_source( $id );
2585
  wppa_index_remove( 'album', $id );
2586
  wppa_clear_catlist();
2599
  function wppa_main_photo($cur = '', $covertype) {
2600
  global $wpdb;
2601
 
2602
+ $a_id = strval( intval( $_REQUEST['edit_id'] ) );
2603
  $photos = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->wppa_photos WHERE `album` = %s " . wppa_get_photo_order( $a_id ) . " LIMIT 1000", $a_id ), ARRAY_A );
2604
 
2605
  $output = '';
2664
  // If random...
2665
  if ( $albumorder_col == 'random' ) {
2666
 
2667
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %s ORDER BY RAND(%d)";
2668
 
2669
  $albums = $wpdb->get_results( $wpdb->prepare( $query, $parent, wppa_get_randseed() ), ARRAY_A );
2670
  }
2675
  switch ( $albumorder_col ) {
2676
 
2677
  case 'a_order':
2678
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY a_order DESC";
2679
  break;
2680
  case 'name':
2681
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY name DESC";
2682
  break;
2683
  case 'timestamp':
2684
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY timestamp DESC";
2685
  break;
2686
  default:
2687
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY id DESC";
2688
 
2689
  }
2690
  }
2695
  switch ( $albumorder_col ) {
2696
 
2697
  case 'a_order':
2698
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY a_order";
2699
  break;
2700
  case 'name':
2701
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY name";
2702
  break;
2703
  case 'timestamp':
2704
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY timestamp";
2705
  break;
2706
  default:
2707
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY id";
2708
 
2709
  }
2710
  }
wppa-album-covers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -1278,13 +1278,13 @@ static $cached_cover_photo_ids;
1278
  if ( '0' == $id ) {
1279
  $rs = wppa_get_randseed( 'page' );
1280
  if ( current_user_can( 'wppa_moderate' ) ) {
1281
- $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
1282
  WHERE album = %s
1283
  ORDER BY RAND(%d)
1284
  LIMIT %d", $alb, $rs, $count ), ARRAY_A );
1285
  }
1286
  else {
1287
- $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
1288
  WHERE album = %s
1289
  AND ( ( status <> 'pending' AND `status` <> 'scheduled' ) OR owner = %s )
1290
  ORDER BY RAND(%d)
@@ -1295,13 +1295,13 @@ static $cached_cover_photo_ids;
1295
  // main_photo is -2? Last upload
1296
  if ( '-2' == $id ) {
1297
  if ( current_user_can( 'wppa_moderate' ) ) {
1298
- $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
1299
  WHERE album = %s
1300
  ORDER BY timestamp DESC
1301
  LIMIT %d", $alb, $count ), ARRAY_A );
1302
  }
1303
  else {
1304
- $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
1305
  WHERE album = %s
1306
  AND ( ( status <> 'pending' AND `status` <> 'scheduled' ) OR owner = %s )
1307
  ORDER BY timestamp DESC
@@ -1312,7 +1312,7 @@ static $cached_cover_photo_ids;
1312
  // main_phtot is -1? Random featured
1313
  if ( '-1' == $id ) {
1314
  $rs = wppa_get_randseed( 'page' );
1315
- $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
1316
  WHERE album = %s AND status = 'featured'
1317
  ORDER BY RAND(%d) LIMIT %d",$alb, $rs, $count ), ARRAY_A );
1318
  }
@@ -1689,7 +1689,7 @@ global $wpdb;
1689
  // If random...
1690
  if ( $albumorder_col == 'random' ) {
1691
 
1692
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY RAND(%d)";
1693
 
1694
  $subs = $wpdb->get_results( $wpdb->prepare( $query, $parent, wppa_get_randseed() ), ARRAY_A );
1695
  }
@@ -1700,16 +1700,16 @@ global $wpdb;
1700
  switch ( $albumorder_col ) {
1701
 
1702
  case 'a_order':
1703
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY a_order DESC";
1704
  break;
1705
  case 'name':
1706
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY name DESC";
1707
  break;
1708
  case 'timestamp':
1709
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY timestamp DESC";
1710
  break;
1711
  default:
1712
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY id DESC";
1713
 
1714
  }
1715
  }
@@ -1720,16 +1720,16 @@ global $wpdb;
1720
  switch ( $albumorder_col ) {
1721
 
1722
  case 'a_order':
1723
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY a_order";
1724
  break;
1725
  case 'name':
1726
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY name";
1727
  break;
1728
  case 'timestamp':
1729
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY timestamp";
1730
  break;
1731
  default:
1732
- $query = "SELECT * FROM {$wpdb->prefix}wppa_albums WHERE a_parent = %d ORDER BY id";
1733
 
1734
  }
1735
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
+ * Version 6.9.20
7
  *
8
  */
9
 
1278
  if ( '0' == $id ) {
1279
  $rs = wppa_get_randseed( 'page' );
1280
  if ( current_user_can( 'wppa_moderate' ) ) {
1281
+ $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1282
  WHERE album = %s
1283
  ORDER BY RAND(%d)
1284
  LIMIT %d", $alb, $rs, $count ), ARRAY_A );
1285
  }
1286
  else {
1287
+ $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1288
  WHERE album = %s
1289
  AND ( ( status <> 'pending' AND `status` <> 'scheduled' ) OR owner = %s )
1290
  ORDER BY RAND(%d)
1295
  // main_photo is -2? Last upload
1296
  if ( '-2' == $id ) {
1297
  if ( current_user_can( 'wppa_moderate' ) ) {
1298
+ $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1299
  WHERE album = %s
1300
  ORDER BY timestamp DESC
1301
  LIMIT %d", $alb, $count ), ARRAY_A );
1302
  }
1303
  else {
1304
+ $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1305
  WHERE album = %s
1306
  AND ( ( status <> 'pending' AND `status` <> 'scheduled' ) OR owner = %s )
1307
  ORDER BY timestamp DESC
1312
  // main_phtot is -1? Random featured
1313
  if ( '-1' == $id ) {
1314
  $rs = wppa_get_randseed( 'page' );
1315
+ $temp = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1316
  WHERE album = %s AND status = 'featured'
1317
  ORDER BY RAND(%d) LIMIT %d",$alb, $rs, $count ), ARRAY_A );
1318
  }
1689
  // If random...
1690
  if ( $albumorder_col == 'random' ) {
1691
 
1692
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY RAND(%d)";
1693
 
1694
  $subs = $wpdb->get_results( $wpdb->prepare( $query, $parent, wppa_get_randseed() ), ARRAY_A );
1695
  }
1700
  switch ( $albumorder_col ) {
1701
 
1702
  case 'a_order':
1703
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY a_order DESC";
1704
  break;
1705
  case 'name':
1706
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY name DESC";
1707
  break;
1708
  case 'timestamp':
1709
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY timestamp DESC";
1710
  break;
1711
  default:
1712
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY id DESC";
1713
 
1714
  }
1715
  }
1720
  switch ( $albumorder_col ) {
1721
 
1722
  case 'a_order':
1723
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY a_order";
1724
  break;
1725
  case 'name':
1726
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY name";
1727
  break;
1728
  case 'timestamp':
1729
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY timestamp";
1730
  break;
1731
  default:
1732
+ $query = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d ORDER BY id";
1733
 
1734
  }
1735
  }
wppa-album-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
- * Version 6.9.14
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -59,7 +59,7 @@ class AlbumWidget extends WP_Widget {
59
  $albums = array();
60
  }
61
  else {
62
- $albums = $wpdb->get_results( 'SELECT * FROM `' . WPPA_ALBUMS . '` ' . wppa_get_album_order(), ARRAY_A );
63
  }
64
  break;
65
  case 'last':
@@ -67,11 +67,13 @@ class AlbumWidget extends WP_Widget {
67
  $albums = array();
68
  }
69
  else {
70
- $albums = $wpdb->get_results( 'SELECT * FROM `' . WPPA_ALBUMS . '` ORDER BY `timestamp` DESC', ARRAY_A );
 
71
  }
72
  break;
73
  default:
74
- $albums = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `' . WPPA_ALBUMS . '` WHERE `a_parent` = %s ' . wppa_get_album_order( $parent ), $parent ), ARRAY_A );
 
75
  }
76
 
77
  $widget_content = "\n".'<!-- WPPA+ album Widget start -->';
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
+ * Version 6.9.20
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
59
  $albums = array();
60
  }
61
  else {
62
+ $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums " . wppa_get_album_order(), ARRAY_A );
63
  }
64
  break;
65
  case 'last':
67
  $albums = array();
68
  }
69
  else {
70
+ $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
71
+ ORDER BY timestamp DESC", ARRAY_A );
72
  }
73
  break;
74
  default:
75
+ $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
76
+ WHERE a_parent = %d " . wppa_get_album_order( $parent ), $parent ), ARRAY_A );
77
  }
78
 
79
  $widget_content = "\n".'<!-- WPPA+ album Widget start -->';
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 6.9.14
7
  *
8
  */
9
 
@@ -431,13 +431,20 @@ global $wppa_supported_camara_brands;
431
  );
432
  $pagelink = wppa_dbg_url( get_page_link( $page ) );
433
  $fontsize = wppa_in_widget() ? 'font-size: 9px;' : '';
434
- $query = "SELECT `id`, `name`, `owner` FROM $wpdb->wppa_albums ORDER BY `name`";
 
435
  $albums = $wpdb->get_results( $query, ARRAY_A );
436
- $query = "SELECT `name` FROM `" . WPPA_PHOTOS .
437
- "` WHERE `status` <> 'pending' AND `status` <> 'scheduled' ORDER BY `name`";
 
 
 
438
  $photonames = $wpdb->get_results( $query, ARRAY_A );
439
- $query = "SELECT `owner` FROM `" .WPPA_PHOTOS .
440
- "` WHERE `status` <> 'pending' AND `status` <> 'scheduled' ORDER BY `owner`";
 
 
 
441
  $ownerlist = $wpdb->get_results( $query, ARRAY_A );
442
  $catlist = wppa_get_catlist();
443
  $taglist = wppa_get_taglist();
@@ -458,15 +465,15 @@ global $wppa_supported_camara_brands;
458
  }
459
  $ss_data['3'] = str_replace( '***', '...', $ss_data['3'] );
460
 
461
- $query = "SELECT `slug` FROM `".WPPA_INDEX."` WHERE `albums` <> '' ORDER BY `slug`";
462
  $albumtxt = $wpdb->get_results( $query, ARRAY_A );
463
- $query = "SELECT `slug` FROM `".WPPA_INDEX."` WHERE `photos` <> '' ORDER BY `slug`";
464
  $phototxt = $wpdb->get_results( $query, ARRAY_A );
465
 
466
  // IPTC
467
  $iptclist = wppa_switch( 'save_iptc' ) ?
468
- $wpdb->get_results( "SELECT `tag`, `description` FROM `" . WPPA_IPTC .
469
- "` WHERE `photo` = '0' AND `status` <> 'hide' ", ARRAY_A ) : array();
470
 
471
  // Translate (for multilanguage qTranslate-able labels )
472
  if ( ! empty( $iptclist ) ) {
@@ -480,8 +487,8 @@ global $wppa_supported_camara_brands;
480
 
481
  // EXIF
482
  $exiflist = wppa_switch( 'save_exif' ) ?
483
- $wpdb->get_results( "SELECT `tag`, `description`, `status` FROM `" . WPPA_EXIF .
484
- "` WHERE `photo` = '0' AND `status` <> 'hide' ", ARRAY_A ) : array();
485
 
486
  // Translate (for multilanguage qTranslate-able labels), // or remove if no non-empty items
487
  //echo serialize($exiflist);
@@ -3477,7 +3484,7 @@ global $wpdb;
3477
  // Loop the comments already there
3478
  $n_comments = 0;
3479
  if ( wppa_switch( 'comments_desc' ) ) $ord = 'DESC'; else $ord = '';
3480
- $comments = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM '.WPPA_COMMENTS.' WHERE photo = %s ORDER BY id '.$ord, $id ), ARRAY_A );
3481
  $com_count = count( $comments );
3482
  $color = 'darkgrey';
3483
  if ( wppa_opt( 'fontcolor_box' ) ) $color = wppa_opt( 'fontcolor_box' );
@@ -3760,7 +3767,10 @@ global $wpdb;
3760
  $wid = '20%';
3761
  if ( wppa_opt( 'fontsize_box' ) ) $wid = ( wppa_opt( 'fontsize_box' ) * 1.5 ).'px';
3762
  $captkey = $id;
3763
- if ( $is_current ) $captkey = $wpdb->get_var( $wpdb->prepare( 'SELECT `timestamp` FROM `'.WPPA_COMMENTS.'` WHERE `id` = %s', wppa( 'comment_id' ) ) );
 
 
 
3764
  $result .=
3765
  wppa_make_captcha( $captkey ) .
3766
  '<input' .
@@ -4018,7 +4028,7 @@ global $wppa_exif_cache;
4018
 
4019
  // Get the photo data
4020
  if ( $exifdata === false ) {
4021
- $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPPA_EXIF."` WHERE `photo`=%s ORDER BY `tag`", $photo ), "ARRAY_A" );
4022
 
4023
  // Save in cache, even when empty
4024
  $wppa_exif_cache[$photo] = $exifdata;
@@ -4622,7 +4632,7 @@ global $wpdb;
4622
  case 'timestamp':
4623
  case 'modified':
4624
  $photos = $wpdb->get_results( "SELECT `id`, `" . $calendar_type . "` " .
4625
- "FROM `" . WPPA_PHOTOS ."` " .
4626
  "WHERE `" . $calendar_type . "` > 0 " .
4627
  "AND `status` <> 'pending' " .
4628
  "AND `status` <> 'scheduled' " .
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 6.9.20
7
  *
8
  */
9
 
431
  );
432
  $pagelink = wppa_dbg_url( get_page_link( $page ) );
433
  $fontsize = wppa_in_widget() ? 'font-size: 9px;' : '';
434
+ $query = "SELECT id, name, owner FROM $wpdb->wppa_albums
435
+ ORDER BY name";
436
  $albums = $wpdb->get_results( $query, ARRAY_A );
437
+ $query = "SELECT name FROM $wpdb->wppa_photos
438
+ WHERE status <> 'pending'
439
+ AND status <> 'scheduled'
440
+ AND album > 0
441
+ ORDER BY name";
442
  $photonames = $wpdb->get_results( $query, ARRAY_A );
443
+ $query = "SELECT owner FROM $wpdb->wppa_photos
444
+ WHERE status <> 'pending'
445
+ AND status <> 'scheduled'
446
+ AND album > 0
447
+ ORDER BY owner";
448
  $ownerlist = $wpdb->get_results( $query, ARRAY_A );
449
  $catlist = wppa_get_catlist();
450
  $taglist = wppa_get_taglist();
465
  }
466
  $ss_data['3'] = str_replace( '***', '...', $ss_data['3'] );
467
 
468
+ $query = "SELECT slug FROM $wpdb->wppa_index WHERE albums <> '' ORDER BY slug";
469
  $albumtxt = $wpdb->get_results( $query, ARRAY_A );
470
+ $query = "SELECT slug FROM $wpdb->wppa_index WHERE photos <> '' ORDER BY slug";
471
  $phototxt = $wpdb->get_results( $query, ARRAY_A );
472
 
473
  // IPTC
474
  $iptclist = wppa_switch( 'save_iptc' ) ?
475
+ $wpdb->get_results( "SELECT tag, description FROM $wpdb->wppa_iptc
476
+ WHERE photo = '0' AND status <> 'hide'", ARRAY_A ) : array();
477
 
478
  // Translate (for multilanguage qTranslate-able labels )
479
  if ( ! empty( $iptclist ) ) {
487
 
488
  // EXIF
489
  $exiflist = wppa_switch( 'save_exif' ) ?
490
+ $wpdb->get_results( "SELECT tag, description, status FROM $wpdb->wppa_exif
491
+ WHERE photo = '0' AND status <> 'hide'", ARRAY_A ) : array();
492
 
493
  // Translate (for multilanguage qTranslate-able labels), // or remove if no non-empty items
494
  //echo serialize($exiflist);
3484
  // Loop the comments already there
3485
  $n_comments = 0;
3486
  if ( wppa_switch( 'comments_desc' ) ) $ord = 'DESC'; else $ord = '';
3487
+ $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE photo = %d ORDER BY id ".$ord, $id ), ARRAY_A );
3488
  $com_count = count( $comments );
3489
  $color = 'darkgrey';
3490
  if ( wppa_opt( 'fontcolor_box' ) ) $color = wppa_opt( 'fontcolor_box' );
3767
  $wid = '20%';
3768
  if ( wppa_opt( 'fontsize_box' ) ) $wid = ( wppa_opt( 'fontsize_box' ) * 1.5 ).'px';
3769
  $captkey = $id;
3770
+ if ( $is_current ) {
3771
+ $captkey = $wpdb->get_var( $wpdb->prepare( "SELECT timestamp FROM $wpdb->wppa_comments
3772
+ WHERE id = %d", wppa( 'comment_id' ) ) );
3773
+ }
3774
  $result .=
3775
  wppa_make_captcha( $captkey ) .
3776
  '<input' .
4028
 
4029
  // Get the photo data
4030
  if ( $exifdata === false ) {
4031
+ $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif WHERE photo = %s ORDER BY tag", $photo ), ARRAY_A );
4032
 
4033
  // Save in cache, even when empty
4034
  $wppa_exif_cache[$photo] = $exifdata;
4632
  case 'timestamp':
4633
  case 'modified':
4634
  $photos = $wpdb->get_results( "SELECT `id`, `" . $calendar_type . "` " .
4635
+ "FROM $wpdb->wppa_photos " .
4636
  "WHERE `" . $calendar_type . "` > 0 " .
4637
  "AND `status` <> 'pending' " .
4638
  "AND `status` <> 'scheduled' " .
wppa-comment-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all comments
6
- * Version 6.9.14
7
  *
8
  */
9
 
@@ -454,7 +454,7 @@ function _wppa_comment_admin() {
454
  <form id="wppa-comment-form" method="GET" >
455
 
456
  <!-- For plugins, we also need to ensure that the form posts back to our current page -->
457
- <input type="hidden" name="page" value="' . $_REQUEST['page'] , '" />
458
 
459
  <!-- Now we can render the completed list table -->';
460
  $testListTable->display();
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all comments
6
+ * Version 6.9.20
7
  *
8
  */
9
 
454
  <form id="wppa-comment-form" method="GET" >
455
 
456
  <!-- For plugins, we also need to ensure that the form posts back to our current page -->
457
+ <input type="hidden" name="page" value="wppa_manage_comments" />
458
 
459
  <!-- Now we can render the completed list table -->';
460
  $testListTable->display();
wppa-cron.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
- * Version 6.9.16
7
  *
8
  *
9
  */
@@ -185,14 +185,14 @@ global $wpdb;
185
  $expire = time() - $lifetime;
186
  $purge = time() - $savetime;
187
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session SET `status` = 'expired' WHERE `timestamp` < %s", $expire ) );
188
- $wpdb->query( $wpdb->prepare( "DELETE FROM `" . WPPA_SESSION ."` WHERE `timestamp` < %s", $purge ) );
189
 
190
  // Delete obsolete spam
191
  $spammaxage = wppa_opt( 'spam_maxage' );
192
  if ( $spammaxage != 'none' ) {
193
  $time = time();
194
  $obsolete = $time - $spammaxage;
195
- $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPPA_COMMENTS."` WHERE `status` = 'spam' AND `timestamp` < %s", $obsolete ) );
196
  if ( $iret ) wppa_update_option( 'wppa_spam_auto_delcount', get_option( 'wppa_spam_auto_delcount', '0' ) + $iret );
197
  }
198
 
@@ -352,7 +352,7 @@ function _wppa_do_clear_cache( $dir ) {
352
  }
353
  }
354
  }
355
-
356
  // Also delete tempfiles
357
  wppa_delete_obsolete_tempfiles();
358
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
+ * Version 6.9.20
7
  *
8
  *
9
  */
185
  $expire = time() - $lifetime;
186
  $purge = time() - $savetime;
187
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session SET `status` = 'expired' WHERE `timestamp` < %s", $expire ) );
188
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_session WHERE `timestamp` < %s", $purge ) );
189
 
190
  // Delete obsolete spam
191
  $spammaxage = wppa_opt( 'spam_maxage' );
192
  if ( $spammaxage != 'none' ) {
193
  $time = time();
194
  $obsolete = $time - $spammaxage;
195
+ $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_comments WHERE status = 'spam' AND timestamp < %s", $obsolete ) );
196
  if ( $iret ) wppa_update_option( 'wppa_spam_auto_delcount', get_option( 'wppa_spam_auto_delcount', '0' ) + $iret );
197
  }
198
 
352
  }
353
  }
354
  }
355
+
356
  // Also delete tempfiles
357
  wppa_delete_obsolete_tempfiles();
358
  }
wppa-encrypt.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all ecryption/decryption logic
6
- * Version 6.9.17
7
  *
8
  */
9
 
@@ -46,7 +46,7 @@ global $wpdb;
46
  sleep( 1 );
47
  $crypt = substr( md5( microtime() ), 0, 12 );
48
  if ( $table == WPPA_PHOTOS ) {
49
- $dup = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM `" . WPPA_PHOTOS . " WHERE `crypt` = %s", $crypt ) );
50
  }
51
  else {
52
  $dup = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM $wpdb->wppa_albums WHERE `crypt` = %s", $crypt ) );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all ecryption/decryption logic
6
+ * Version 6.9.20
7
  *
8
  */
9
 
46
  sleep( 1 );
47
  $crypt = substr( md5( microtime() ), 0, 12 );
48
  if ( $table == WPPA_PHOTOS ) {
49
+ $dup = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM `$wpdb->wppa_photos WHERE `crypt` = %s", $crypt ) );
50
  }
51
  else {
52
  $dup = $wpdb->get_var( $wpdb->prepare( "SELECT `id` FROM $wpdb->wppa_albums WHERE `crypt` = %s", $crypt ) );
wppa-exif-iptc-common.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * exif and iptc common functions
6
- * version 6.9.16
7
  *
8
  *
9
  */
@@ -3065,12 +3065,12 @@ static $labels;
3065
  // There is iptc data for this image.
3066
  // First delete any existing ipts data for this image
3067
  if ( ! $nodelete ) {
3068
- $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPPA_IPTC."` WHERE `photo` = %s", $id ) );
3069
  }
3070
 
3071
  // Find defined labels
3072
  if ( ! is_array( $labels ) ) {
3073
- $result = $wpdb->get_results( "SELECT `tag` FROM `".WPPA_IPTC."` WHERE `photo` = '0' ORDER BY `tag`", ARRAY_N );
3074
 
3075
  if ( ! is_array( $result ) ) $result = array();
3076
  $labels = array();
@@ -3218,12 +3218,12 @@ global $wppa;
3218
  // There is exif data for this image.
3219
  // First delete any existing exif data for this image
3220
  if ( ! $nodelete ) {
3221
- $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPPA_EXIF."` WHERE `photo` = %s", $id ) );
3222
  }
3223
 
3224
  // Find defined labels
3225
  if ( ! is_array( $labels ) ) {
3226
- $result = $wpdb->get_results( "SELECT * FROM `".WPPA_EXIF."` WHERE `photo` = '0' ORDER BY `tag`", ARRAY_A );
3227
 
3228
  if ( ! is_array( $result ) ) $result = array();
3229
  $labels = array();
3
  * Package: wp-photo-album-plus
4
  *
5
  * exif and iptc common functions
6
+ * version 6.9.20
7
  *
8
  *
9
  */
3065
  // There is iptc data for this image.
3066
  // First delete any existing ipts data for this image
3067
  if ( ! $nodelete ) {
3068
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_iptc WHERE photo = %d", $id ) );
3069
  }
3070
 
3071
  // Find defined labels
3072
  if ( ! is_array( $labels ) ) {
3073
+ $result = $wpdb->get_results( "SELECT tag FROM $wpdb->wppa_iptc WHERE photo = '0' ORDER BY tag", ARRAY_N );
3074
 
3075
  if ( ! is_array( $result ) ) $result = array();
3076
  $labels = array();
3218
  // There is exif data for this image.
3219
  // First delete any existing exif data for this image
3220
  if ( ! $nodelete ) {
3221
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_exif WHERE photo = %s", $id ) );
3222
  }
3223
 
3224
  // Find defined labels
3225
  if ( ! is_array( $labels ) ) {
3226
+ $result = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_exif WHERE photo = '0' ORDER BY tag", ARRAY_A );
3227
 
3228
  if ( ! is_array( $result ) ) $result = array();
3229
  $labels = array();
wppa-export.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -108,7 +108,8 @@ global $wppa_temp_idx;
108
  if (isset($_POST['album-'.$id])) {
109
  _e('<br/>Processing album', 'wp-photo-album-plus'); echo(' '.$id.'....');
110
  wppa_write_album_file_by_id($id);
111
- $photos = $wpdb->get_results($wpdb->prepare( 'SELECT * FROM ' . WPPA_PHOTOS . ' WHERE album = %s', $id), 'ARRAY_A' );
 
112
  $cnt = 0;
113
  foreach ( $photos as $photo ) {
114
 
@@ -157,7 +158,10 @@ global $wpdb;
157
  global $wppa_zip;
158
  global $wppa_temp;
159
  global $wppa_temp_idx;
160
- $album = $wpdb->get_row($wpdb->prepare( 'SELECT * FROM '.WPPA_ALBUMS.' WHERE id = %s LIMIT 0,1', $id ), 'ARRAY_A');
 
 
 
161
  if ($album) {
162
  $fname = WPPA_DEPOT_PATH.'/'.$id.'.amf';
163
  $file = wppa_fopen($fname, 'wb');
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
+ * Version 6.9.20
7
  *
8
  */
9
 
108
  if (isset($_POST['album-'.$id])) {
109
  _e('<br/>Processing album', 'wp-photo-album-plus'); echo(' '.$id.'....');
110
  wppa_write_album_file_by_id($id);
111
+ $photos = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
112
+ WHERE album = %d", $id ), ARRAY_A );
113
  $cnt = 0;
114
  foreach ( $photos as $photo ) {
115
 
158
  global $wppa_zip;
159
  global $wppa_temp;
160
  global $wppa_temp_idx;
161
+
162
+ $album = $wpdb->get_row($wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
163
+ WHERE id = %d", $id ), ARRAY_A );
164
+
165
  if ($album) {
166
  $fname = WPPA_DEPOT_PATH.'/'.$id.'.amf';
167
  $file = wppa_fopen($fname, 'wb');
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 6.9.19
7
  *
8
  */
9
 
@@ -1003,8 +1003,8 @@ global $wppa_session;
1003
 
1004
  // If Catbox specifies a category to limit, remove all albums that do not have the desired cat.
1005
  if ( wppa( 'catbox' ) ) {
1006
- $likecats = '%' . esc_like( wppa( 'catbox' ) ) . '%';
1007
- $catalbs = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}wppa_albums
1008
  WHERE cats LIKE %s", $likecats ) );
1009
  $final_array = array_intersect( $final_array, $catalbs );
1010
  }
@@ -1016,7 +1016,7 @@ global $wppa_session;
1016
  }
1017
 
1018
  // Get them
1019
- $albums = $wpdb->get_results( "SELECT * FROM {$wpdb->prefix}wppa_albums
1020
  WHERE " . $selection . " " . wppa_get_album_order( '0' ), ARRAY_A );
1021
 
1022
  // Exclusive separate albums?
@@ -1076,10 +1076,10 @@ global $wppa_session;
1076
  }
1077
  elseif ( wppa_is_int( $id ) ) {
1078
  if ( wppa( 'is_cover' ) ) {
1079
- $q = $wpdb->prepare( 'SELECT * FROM ' . WPPA_ALBUMS . ' WHERE `id` = %s', $id );
1080
  }
1081
  else {
1082
- $q = $wpdb->prepare( 'SELECT * FROM ' . WPPA_ALBUMS . ' WHERE `a_parent` = %s '. wppa_get_album_order( $id ), $id );
1083
  }
1084
  $albums = $wpdb->get_results( $q, ARRAY_A );
1085
  }
@@ -2047,8 +2047,10 @@ static $user;
2047
  $my_youngest_rating_dtm = 0;
2048
  }
2049
  else {
2050
- $rats = $wpdb->get_results( $wpdb->prepare( "SELECT `value`, `timestamp` FROM `".WPPA_RATING."` " .
2051
- "WHERE `photo` = %s AND `user` = %s AND `status` = 'publish'", $id, $user ), ARRAY_A );
 
 
2052
  if ( $rats ) {
2053
  $n = 0;
2054
  $accu = 0;
@@ -2083,7 +2085,10 @@ static $user;
2083
  }
2084
 
2085
  // Find the dislike count
2086
- $discount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_RATING."` WHERE `photo` = %s AND `value` = -1 AND `status` = %s", $id, 'publish' ) );
 
 
 
2087
 
2088
  // Make the discount textual
2089
  $distext = wppa_get_distext( $discount, $myrat );
@@ -2424,7 +2429,7 @@ global $wppa_done;
2424
  if ( ( is_user_logged_in() && wppa_opt( 'comment_captcha' ) == 'all' ) ||
2425
  ( ! is_user_logged_in() && wppa_opt( 'comment_captcha' ) != 'none' ) ) {
2426
  $captkey = $id;
2427
- if ( $cedit ) $captkey = $wpdb->get_var( $wpdb->prepare( 'SELECT `timestamp` FROM `'.WPPA_COMMENTS.'` WHERE `id` = %s', $cedit ) );
2428
  if ( ! wppa_check_captcha( $captkey ) ) {
2429
  $status = 'spam';
2430
  $wrong_captcha = true;
@@ -2434,17 +2439,10 @@ global $wppa_done;
2434
  // Process ( edited ) comment
2435
  if ( $comment ) {
2436
  if ( $cedit ) {
2437
- $query = $wpdb->prepare(
2438
- "UPDATE $wpdb->wppa_comments".
2439
- " SET `comment` = %s, `user` = %s, `email` = %s, `status` = %s, `timestamp` = %s " .
2440
- " WHERE `id` = %s LIMIT 1",
2441
- $save_comment,
2442
- $user,
2443
- $email,
2444
- $status,
2445
- time(),
2446
- $cedit
2447
- );
2448
  $iret = $wpdb->query( $query );
2449
  if ( $iret !== false ) {
2450
  wppa( 'comment_id', $cedit );
@@ -2453,7 +2451,13 @@ global $wppa_done;
2453
  else {
2454
 
2455
  // See if a refresh happened
2456
- $old_entry = $wpdb->prepare( 'SELECT * FROM `'.WPPA_COMMENTS.'` WHERE `photo` = %s AND `user` = %s AND `comment` = %s LIMIT 1', $photo, $user, $save_comment );
 
 
 
 
 
 
2457
  $iret = $wpdb->query( $old_entry );
2458
  if ( $iret ) {
2459
  if ( wppa( 'debug' ) ) echo( '<script type="text/javascript" >alert( "Duplicate comment ignored" )</script>' );
@@ -2635,7 +2639,7 @@ global $wppa_done;
2635
  }
2636
  if ( wppa_switch( 'com_notify_previous' ) ) {
2637
  // Mail users already commented on this photo
2638
- $cmnts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPPA_COMMENTS."` WHERE `photo` = %d", $photo ), ARRAY_A );
2639
  if ( $cmnts ) foreach( $cmnts as $cmnt ) {
2640
  $user = $cmnt['user'];
2641
  if ( ! in_array( $user, $sentto ) ) {
@@ -2667,7 +2671,10 @@ global $wppa_done;
2667
 
2668
  // Process any pending votes of this user for this photo if rating needs comment, do it anyway, feature may have been on but now off
2669
  // if ( wppa_switch( 'vote_needs_comment' ) ) {
2670
- $iret = $wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_RATING."` SET `status` = 'publish' WHERE `photo` = %s AND `user` = %s", $id, wppa_get_user() ) );
 
 
 
2671
  if ( $iret ) wppa_rate_photo( $id ); // Recalc ratings for this photo
2672
  // }
2673
 
@@ -2772,7 +2779,7 @@ global $wpdb;
2772
  $rating = esc_js( $rating );
2773
 
2774
  if ( wppa_switch( 'popup_text_ncomments' ) ) {
2775
- $ncom = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_COMMENTS."` WHERE `photo` = %s AND `status` = 'approved'", $id ) );
2776
  }
2777
  else $ncom = '0';
2778
  if ( $ncom ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 6.9.20
7
  *
8
  */
9
 
1003
 
1004
  // If Catbox specifies a category to limit, remove all albums that do not have the desired cat.
1005
  if ( wppa( 'catbox' ) ) {
1006
+ $likecats = '%' . $wpdb->esc_like( wppa( 'catbox' ) ) . '%';
1007
+ $catalbs = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums
1008
  WHERE cats LIKE %s", $likecats ) );
1009
  $final_array = array_intersect( $final_array, $catalbs );
1010
  }
1016
  }
1017
 
1018
  // Get them
1019
+ $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
1020
  WHERE " . $selection . " " . wppa_get_album_order( '0' ), ARRAY_A );
1021
 
1022
  // Exclusive separate albums?
1076
  }
1077
  elseif ( wppa_is_int( $id ) ) {
1078
  if ( wppa( 'is_cover' ) ) {
1079
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id = %d", $id );
1080
  }
1081
  else {
1082
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d " . wppa_get_album_order( $id ), $id );
1083
  }
1084
  $albums = $wpdb->get_results( $q, ARRAY_A );
1085
  }
2047
  $my_youngest_rating_dtm = 0;
2048
  }
2049
  else {
2050
+ $rats = $wpdb->get_results( $wpdb->prepare( "SELECT value, timestamp FROM $wpdb->wppa_rating
2051
+ WHERE photo = %d
2052
+ AND user = %s
2053
+ AND status = 'publish'", $id, $user ), ARRAY_A );
2054
  if ( $rats ) {
2055
  $n = 0;
2056
  $accu = 0;
2085
  }
2086
 
2087
  // Find the dislike count
2088
+ $discount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_rating
2089
+ WHERE photo = %d
2090
+ AND value = -1
2091
+ AND status = 'publish'", $id ) );
2092
 
2093
  // Make the discount textual
2094
  $distext = wppa_get_distext( $discount, $myrat );
2429
  if ( ( is_user_logged_in() && wppa_opt( 'comment_captcha' ) == 'all' ) ||
2430
  ( ! is_user_logged_in() && wppa_opt( 'comment_captcha' ) != 'none' ) ) {
2431
  $captkey = $id;
2432
+ if ( $cedit ) $captkey = $wpdb->get_var( $wpdb->prepare( "SELECT timestamp FROM $wpdb->wppa_comments WHERE id = %d", $cedit ) );
2433
  if ( ! wppa_check_captcha( $captkey ) ) {
2434
  $status = 'spam';
2435
  $wrong_captcha = true;
2439
  // Process ( edited ) comment
2440
  if ( $comment ) {
2441
  if ( $cedit ) {
2442
+ $query = $wpdb->prepare( "UPDATE $wpdb->wppa_comments
2443
+ SET comment = %s, user = %s, email = %s, status = %s, timestamp = %s
2444
+ WHERE id = %d", $save_comment, $user, $email, $status, time(), $cedit );
2445
+
 
 
 
 
 
 
 
2446
  $iret = $wpdb->query( $query );
2447
  if ( $iret !== false ) {
2448
  wppa( 'comment_id', $cedit );
2451
  else {
2452
 
2453
  // See if a refresh happened
2454
+ $old_entry = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments
2455
+ WHERE photo = %d
2456
+ AND user = %s
2457
+ AND comment = %s
2458
+ ORDER BY timestamp DESC
2459
+ LIMIT 1", $photo, $user, $save_comment );
2460
+
2461
  $iret = $wpdb->query( $old_entry );
2462
  if ( $iret ) {
2463
  if ( wppa( 'debug' ) ) echo( '<script type="text/javascript" >alert( "Duplicate comment ignored" )</script>' );
2639
  }
2640
  if ( wppa_switch( 'com_notify_previous' ) ) {
2641
  // Mail users already commented on this photo
2642
+ $cmnts = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE photo = %d", $photo ), ARRAY_A );
2643
  if ( $cmnts ) foreach( $cmnts as $cmnt ) {
2644
  $user = $cmnt['user'];
2645
  if ( ! in_array( $user, $sentto ) ) {
2671
 
2672
  // Process any pending votes of this user for this photo if rating needs comment, do it anyway, feature may have been on but now off
2673
  // if ( wppa_switch( 'vote_needs_comment' ) ) {
2674
+ $iret = $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_rating
2675
+ SET status = 'publish'
2676
+ WHERE photo = %d AND user = %s", $id, wppa_get_user() ) );
2677
+
2678
  if ( $iret ) wppa_rate_photo( $id ); // Recalc ratings for this photo
2679
  // }
2680
 
2779
  $rating = esc_js( $rating );
2780
 
2781
  if ( wppa_switch( 'popup_text_ncomments' ) ) {
2782
+ $ncom = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments WHERE photo = %d AND status = 'approved'", $id ) );
2783
  }
2784
  else $ncom = '0';
2785
  if ( $ncom ) {
wppa-import.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -539,7 +539,7 @@ global $wppa_session;
539
  ' checked="checked"' .
540
  ' />' .
541
  '&nbsp;&nbsp;' .
542
- basename( $file ) . '&nbsp;' . stripslashes( wppa_get_meta_name( $file, '( ' ) ) .
543
  '</td>';
544
  if ( $ct == 3 ) {
545
  echo( '</tr><tr>' );
@@ -816,10 +816,10 @@ global $wppa_session;
816
 
817
  if ( wppa( 'is_wppa_tree' ) ) {
818
  $t = explode( 'uploads/wppa/', $file );
819
- echo $t[1];
820
  }
821
  else {
822
- echo( wppa_sanitize_file_name( basename( $file ) ) );
823
  }
824
 
825
  if ( $meta ) {
@@ -847,7 +847,7 @@ global $wppa_session;
847
  }
848
  }
849
  echo
850
- '<img src="' . $img_url . '"' .
851
  ' alt="N.A."' .
852
  ' style="max-height:48px;"' .
853
  ' onmouseover="if (jQuery(\'#wppa-zoom\').attr(\'checked\')) jQuery(this).css(\'max-height\', \'144px\')"' .
@@ -960,7 +960,7 @@ global $wppa_session;
960
  ' type="checkbox"' .
961
  ' id="file-' . $idx . '"' .
962
  ' name="file-' . $idx . '"' .
963
- ' title="' . $file . '"' .
964
  ' class="wppa-video"' .
965
  ' checked="checked"' .
966
  ' />' .
@@ -1072,7 +1072,7 @@ global $wppa_session;
1072
  ' type="checkbox"' .
1073
  ' id="file-' . $idx . '"' .
1074
  ' name="file-' . $idx . '"' .
1075
- ' title="' . $file . '"' .
1076
  ' class="wppa-audio"' .
1077
  ' checked="checked"' .
1078
  ' />' .
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 6.9.20
7
  *
8
  */
9
 
539
  ' checked="checked"' .
540
  ' />' .
541
  '&nbsp;&nbsp;' .
542
+ sanitize_text_field( basename( $file ) . '&nbsp;' . wppa_get_meta_name( $file, '( ' ) ) .
543
  '</td>';
544
  if ( $ct == 3 ) {
545
  echo( '</tr><tr>' );
816
 
817
  if ( wppa( 'is_wppa_tree' ) ) {
818
  $t = explode( 'uploads/wppa/', $file );
819
+ echo basename( str_replace( '/', '', $t[1] ) );
820
  }
821
  else {
822
+ echo wppa_sanitize_file_name( basename( $file ) );
823
  }
824
 
825
  if ( $meta ) {
847
  }
848
  }
849
  echo
850
+ '<img src="' . esc_url( $img_url ) . '"' .
851
  ' alt="N.A."' .
852
  ' style="max-height:48px;"' .
853
  ' onmouseover="if (jQuery(\'#wppa-zoom\').attr(\'checked\')) jQuery(this).css(\'max-height\', \'144px\')"' .
960
  ' type="checkbox"' .
961
  ' id="file-' . $idx . '"' .
962
  ' name="file-' . $idx . '"' .
963
+ ' title="' . esc_attr( $file ) . '"' .
964
  ' class="wppa-video"' .
965
  ' checked="checked"' .
966
  ' />' .
1072
  ' type="checkbox"' .
1073
  ' id="file-' . $idx . '"' .
1074
  ' name="file-' . $idx . '"' .
1075
+ ' title="' . esc_attr( $file ) . '"' .
1076
  ' class="wppa-audio"' .
1077
  ' checked="checked"' .
1078
  ' />' .
wppa-index.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all indexing functions
6
- * Version 6.9.14
7
  *
8
  *
9
  */
@@ -414,17 +414,18 @@ global $wpdb;
414
  return;
415
  }
416
 
417
- $iam_big = ( $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_INDEX."`" ) > '10000' ); // More than 10.000 index entries,
418
  if ( $iam_big && $id < '100' ) return; // Need at least 3 digits to match
419
 
420
  if ( $type == 'album' ) {
421
  if ( $iam_big ) {
422
  // This is not strictly correct, the may be 24..28 when searching for 26, this will be missed. However this will not lead to problems during search.
423
- $indexes = $wpdb->get_results( "SELECT * FROM `".WPPA_INDEX."` WHERE `albums` LIKE '".$id."'", ARRAY_A );
 
424
  }
425
  else {
426
  // There are too many results on large systems, resulting in a 500 error, but it is strictly correct
427
- $indexes = $wpdb->get_results( "SELECT * FROM `".WPPA_INDEX."` WHERE `albums` <> ''", ARRAY_A );
428
  }
429
  if ( $indexes ) foreach ( $indexes as $indexline ) {
430
  $array = wppa_index_string_to_array($indexline['albums']);
@@ -432,7 +433,7 @@ global $wpdb;
432
  if ( $array[$k] == intval($id) ) {
433
  unset ( $array[$k] );
434
  $string = wppa_index_array_to_string($array);
435
- $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_index SET `albums` = %s WHERE `id` = %d", $string, $indexline['id'] ) );
436
  }
437
  }
438
  }
@@ -440,7 +441,8 @@ global $wpdb;
440
  elseif ( $type == 'photo' ) {
441
  if ( $iam_big ) {
442
  // This is not strictly correct, the may be 24..28 when searching for 26, this will be missed. However this will not lead to problems during search.
443
- $indexes = $wpdb->get_results( "SELECT * FROM `".WPPA_INDEX."` WHERE `photos` LIKE '%".$id."%'", ARRAY_A );
 
444
  }
445
  else {
446
  $indexes = $wpdb->get_results( "SELECT * FROM `".WPPA_INDEX."` WHERE `photos` <> ''", ARRAY_A );
@@ -459,7 +461,7 @@ global $wpdb;
459
  }
460
  else wppa_dbg_msg('Error, unimplemented type in wppa_index_remove().', 'red', 'force');
461
 
462
- $wpdb->query( "DELETE FROM `".WPPA_INDEX."` WHERE `albums` = '' AND `photos` = ''" ); // Cleanup empty entries
463
  }
464
 
465
  // Re-index an edited item
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all indexing functions
6
+ * Version 6.9.20
7
  *
8
  *
9
  */
414
  return;
415
  }
416
 
417
+ $iam_big = ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_index" ) > '10000' ); // More than 10.000 index entries,
418
  if ( $iam_big && $id < '100' ) return; // Need at least 3 digits to match
419
 
420
  if ( $type == 'album' ) {
421
  if ( $iam_big ) {
422
  // This is not strictly correct, the may be 24..28 when searching for 26, this will be missed. However this will not lead to problems during search.
423
+ $indexes = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
424
+ WHERE albums LIKE %s", '%' . $wpdb->esc_like( $id ) . '%'), ARRAY_A );
425
  }
426
  else {
427
  // There are too many results on large systems, resulting in a 500 error, but it is strictly correct
428
+ $indexes = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_index WHERE albums <> ''", ARRAY_A );
429
  }
430
  if ( $indexes ) foreach ( $indexes as $indexline ) {
431
  $array = wppa_index_string_to_array($indexline['albums']);
433
  if ( $array[$k] == intval($id) ) {
434
  unset ( $array[$k] );
435
  $string = wppa_index_array_to_string($array);
436
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_index SET albums = %s WHERE id = %d", $string, $indexline['id'] ) );
437
  }
438
  }
439
  }
441
  elseif ( $type == 'photo' ) {
442
  if ( $iam_big ) {
443
  // This is not strictly correct, the may be 24..28 when searching for 26, this will be missed. However this will not lead to problems during search.
444
+ $indexes = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
445
+ WHERE photos LIKE %s", '%' . $wpdb->esc_js( $id ) . '%' ), ARRAY_A );
446
  }
447
  else {
448
  $indexes = $wpdb->get_results( "SELECT * FROM `".WPPA_INDEX."` WHERE `photos` <> ''", ARRAY_A );
461
  }
462
  else wppa_dbg_msg('Error, unimplemented type in wppa_index_remove().', 'red', 'force');
463
 
464
+ $wpdb->query( "DELETE FROM $wpdb->wppa_index WHERE albums = '' AND photos = ''" ); // Cleanup empty entries
465
  }
466
 
467
  // Re-index an edited item
wppa-init.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
- * Version 6.9.16
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
+ * Version 6.9.20
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
wppa-links.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
- * Version 6.9.14
7
  *
8
  */
9
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
+ * Version 6.9.20
7
  *
8
  */
9
 
wppa-maintenance.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -883,8 +883,10 @@ global $wppa_timestamp_start;
883
  // Process index
884
  $table = WPPA_INDEX;
885
 
886
- $topid = $wpdb->get_var( "SELECT `id` FROM `".WPPA_INDEX."` ORDER BY `id` DESC LIMIT 1" );
887
- $indexes = $wpdb->get_results( "SELECT * FROM `".WPPA_INDEX."` WHERE `id` > ".$lastid." ORDER BY `id` LIMIT ".$chunksize, ARRAY_A );
 
 
888
 
889
  if ( $indexes ) foreach ( array_keys( $indexes ) as $idx ) {
890
 
@@ -977,7 +979,8 @@ global $wppa_timestamp_start;
977
  $albums = wppa_index_array_to_string( $albums );
978
  $photos = wppa_index_array_to_string( $photos );
979
  if ( $albums != $indexes[$idx]['albums'] || $photos != $indexes[$idx]['photos'] ) {
980
- $query = $wpdb->prepare( "UPDATE `".WPPA_INDEX."` SET `albums` = %s, `photos` = %s WHERE `id` = %s", $albums, $photos, $indexes[$idx]['id'] );
 
981
  $wpdb->query( $query );
982
  }
983
  break;
@@ -1092,7 +1095,7 @@ global $wppa_timestamp_start;
1092
  wppa_schedule_maintenance_proc( 'wppa_cleanup_index' );
1093
  break;
1094
  case 'wppa_cleanup_index':
1095
- $wpdb->query( "DELETE FROM `".WPPA_INDEX."` WHERE `albums` = '' AND `photos` = ''" ); // Remove empty entries
1096
  delete_option( 'wppa_index_need_remake' );
1097
  break;
1098
  case 'wppa_apply_default_photoname_all':
@@ -1183,8 +1186,9 @@ global $wppa_log_file;
1183
  // List the search index table
1184
  case 'wppa_list_index':
1185
  $start = get_option( 'wppa_list_index_display_start', '' );
1186
- $total = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_INDEX."`" );
1187
- $indexes = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPPA_INDEX."` WHERE `slug` >= %s ORDER BY `slug` LIMIT 1000", $start ), ARRAY_A );
 
1188
 
1189
  $result .=
1190
  '<h2>' .
@@ -1255,8 +1259,8 @@ global $wppa_log_file;
1255
  break;
1256
 
1257
  case 'wppa_list_rating':
1258
- $total = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_RATING."`" );
1259
- $ratings = $wpdb->get_results( "SELECT * FROM `".WPPA_RATING."` ORDER BY `timestamp` DESC LIMIT 1000", ARRAY_A );
1260
  $result .=
1261
  '<h2>' .
1262
  sprintf( __( 'List of recent ratings <small>( Max 1000 entries of total %d )</small>', 'wp-photo-album-plus' ), $total ) .
@@ -1316,8 +1320,8 @@ global $wppa_log_file;
1316
  break;
1317
 
1318
  case 'wppa_list_session':
1319
- $total = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_SESSION."`" );
1320
- $sessions = $wpdb->get_results( "SELECT * FROM `".WPPA_SESSION."` ORDER BY `id` DESC LIMIT 1000", ARRAY_A );
1321
  $result .=
1322
  '<h2>' .
1323
  sprintf( __( 'List of sessions <small>( Max 1000 entries of total %d )</small>', 'wp-photo-album-plus' ), $total ) .
@@ -1397,12 +1401,12 @@ global $wppa_log_file;
1397
  break;
1398
 
1399
  case 'wppa_list_comments':
1400
- $total = $wpdb->get_var( "SELECT COUNT(*) FROM `".WPPA_COMMENTS."`" );
1401
  $order = wppa_opt( 'list_comments_by' );
1402
  if ( $order == 'timestamp' ) $order .= ' DESC';
1403
  if ( $order == 'name' ) $order = 'user';
1404
- $query = "SELECT * FROM `".WPPA_COMMENTS."` ORDER BY ".$order." LIMIT 1000";
1405
- // $result .= $query.'<br />';
1406
  $comments = $wpdb->get_results( $query, ARRAY_A );
1407
  $result .=
1408
  '<h2>' .
@@ -1453,7 +1457,6 @@ global $wppa_log_file;
1453
  }
1454
  else {
1455
  $result .= __( 'There are no comments', 'wp-photo-album-plus' );
1456
- $result .= '<br />Query='.$wpdb->prepare( "SELECT * FROM `".WPPA_COMMENTS."` ORDER BY %s DESC LIMIT 1000", wppa_opt( 'list_comments_by' ) );
1457
  }
1458
  $result .= '
1459
  </div><div style="clear:both;"></div>';
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 6.9.20
7
  *
8
  */
9
 
883
  // Process index
884
  $table = WPPA_INDEX;
885
 
886
+ $topid = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_index ORDER BY id DESC LIMIT 1" );
887
+ $indexes = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
888
+ WHERE id > %d
889
+ ORDER BY id LIMIT %d", $lastid, $chunksize ), ARRAY_A );
890
 
891
  if ( $indexes ) foreach ( array_keys( $indexes ) as $idx ) {
892
 
979
  $albums = wppa_index_array_to_string( $albums );
980
  $photos = wppa_index_array_to_string( $photos );
981
  if ( $albums != $indexes[$idx]['albums'] || $photos != $indexes[$idx]['photos'] ) {
982
+ $query = $wpdb->prepare( "UPDATE $wpdb->wppa_index
983
+ SET albums = %s, photos = %s WHERE id = %d", $albums, $photos, $indexes[$idx]['id'] );
984
  $wpdb->query( $query );
985
  }
986
  break;
1095
  wppa_schedule_maintenance_proc( 'wppa_cleanup_index' );
1096
  break;
1097
  case 'wppa_cleanup_index':
1098
+ $wpdb->query( "DELETE FROM $wpdb->wppa_index WHERE albums = '' AND photos = ''" ); // Remove empty entries
1099
  delete_option( 'wppa_index_need_remake' );
1100
  break;
1101
  case 'wppa_apply_default_photoname_all':
1186
  // List the search index table
1187
  case 'wppa_list_index':
1188
  $start = get_option( 'wppa_list_index_display_start', '' );
1189
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_index" );
1190
+ $indexes = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1191
+ WHERE slug >= %s ORDER BY slug LIMIT 1000", $start ), ARRAY_A );
1192
 
1193
  $result .=
1194
  '<h2>' .
1259
  break;
1260
 
1261
  case 'wppa_list_rating':
1262
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_rating" );
1263
+ $ratings = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_rating ORDER BY timestamp DESC LIMIT 1000", ARRAY_A );
1264
  $result .=
1265
  '<h2>' .
1266
  sprintf( __( 'List of recent ratings <small>( Max 1000 entries of total %d )</small>', 'wp-photo-album-plus' ), $total ) .
1320
  break;
1321
 
1322
  case 'wppa_list_session':
1323
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_session" );
1324
+ $sessions = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_session ORDER BY `id` DESC LIMIT 1000", ARRAY_A );
1325
  $result .=
1326
  '<h2>' .
1327
  sprintf( __( 'List of sessions <small>( Max 1000 entries of total %d )</small>', 'wp-photo-album-plus' ), $total ) .
1401
  break;
1402
 
1403
  case 'wppa_list_comments':
1404
+ $total = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_comments" );
1405
  $order = wppa_opt( 'list_comments_by' );
1406
  if ( $order == 'timestamp' ) $order .= ' DESC';
1407
  if ( $order == 'name' ) $order = 'user';
1408
+ $query = "SELECT * FROM $wpdb->wppa_comments ORDER BY $order LIMIT 1000";
1409
+
1410
  $comments = $wpdb->get_results( $query, ARRAY_A );
1411
  $result .=
1412
  '<h2>' .
1457
  }
1458
  else {
1459
  $result .= __( 'There are no comments', 'wp-photo-album-plus' );
 
1460
  }
1461
  $result .= '
1462
  </div><div style="clear:both;"></div>';
wppa-non-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
- * Version 6.9.16
7
  *
8
  */
9
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
+ * Version 6.9.20
7
  *
8
  */
9
 
wppa-photo-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
- * Version 6.9.17
7
  *
8
  */
9
 
@@ -108,7 +108,7 @@ global $wpdb;
108
 
109
  // Edit trashed photos
110
  elseif ( $album == 'trash' ) {
111
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
112
  WHERE album < '0' ORDER BY modified DESC
113
  LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
114
  $count = is_array( $photos ) ? count( $photos ) : 0;
@@ -124,7 +124,7 @@ global $wpdb;
124
  elseif ( $album == 'single' ) {
125
  $p = strval( intval( $_REQUEST['photo'] ) );
126
  $count = $p ? 1 : 0;
127
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
128
  WHERE id = %d", $p ), ARRAY_A );
129
  $count = is_array( $photos ) ? count( $photos ) : 0;
130
  $link = '';
@@ -134,7 +134,7 @@ global $wpdb;
134
  else {
135
  $counts = wppa_get_treecounts_a( $album, true );
136
  $count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
137
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
138
  WHERE album = %s
139
  " . wppa_get_photo_order( $album ) . "
140
  LIMIT %d, %d", $album, $skip, $pagesize ), ARRAY_A );
@@ -151,14 +151,14 @@ global $wpdb;
151
  // Edit a single photo
152
  elseif ( $photo && ! $moderate ) {
153
  $count = '1';
154
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
155
  WHERE id = %s", $photo ), ARRAY_A );
156
  $link = '';
157
  }
158
 
159
  // Edit the photos of a specific owner
160
  elseif ( $owner ) {
161
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
162
  WHERE owner = %s
163
  ORDER BY timestamp DESC
164
  LIMIT %d, %d", $owner, $skip, $pagesize ), ARRAY_A );
@@ -176,8 +176,8 @@ global $wpdb;
176
 
177
  // Moderate a single photo
178
  if ( $photo ) {
179
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
180
- WHERE `id` = %s", $photo ), ARRAY_A );
181
  $count = is_array( $photos ) ? count( $photos ) : 0;
182
  $link = '';
183
  }
@@ -186,7 +186,7 @@ global $wpdb;
186
  else {
187
 
188
  // Find pending comments
189
- $cmt = $wpdb->get_results( "SELECT photo FROM {$wpdb->prefix}wppa_comments
190
  WHERE status = 'pending'
191
  OR `status` = 'spam'", ARRAY_A );
192
 
@@ -197,13 +197,22 @@ global $wpdb;
197
  $cmt = array_unique( $cmt );
198
 
199
  foreach( $cmt as $id ) {
200
- $photos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
201
  WHERE id = %d", $id ), ARRAY_A );
202
  }
 
203
  }
204
  $link = wppa_dbg_url( get_admin_url() . 'admin.php' . '?page=wppa_moderate_photos' . '&wppa_nonce=' . wp_create_nonce('wppa_nonce') );
205
  }
206
 
 
 
 
 
 
 
 
 
207
  // No photos to moderate
208
  if ( empty( $photos ) ) {
209
 
@@ -230,7 +239,7 @@ global $wpdb;
230
  __( 'Manage all photos by timestamp' , 'wp-photo-album-plus') .
231
  '</h3>';
232
 
233
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
234
  ORDER BY `timestamp` DESC
235
  LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
236
 
@@ -2056,7 +2065,7 @@ function wppaToggleExif( id, count ) {
2056
 
2057
  // Exif
2058
  if ( ! $quick ) {
2059
- $exifs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_exif
2060
  WHERE photo = %s
2061
  ORDER BY tag, id", $id ), ARRAY_A );
2062
  if ( ! empty( $exifs ) ) {
@@ -2127,7 +2136,7 @@ function wppaToggleExif( id, count ) {
2127
 
2128
  // Comments
2129
  if ( ! $quick ) {
2130
- $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_comments
2131
  WHERE photo = %s
2132
  ORDER BY timestamp DESC ", $id ), ARRAY_A );
2133
  if ( ! empty( $comments ) ) {
@@ -2239,9 +2248,9 @@ function wppa_album_photos_bulk( $album ) {
2239
  break;
2240
  case 'wppa-bulk-move-to':
2241
  if ( $newalb ) {
2242
- $photo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos WHERE `id` = %s", $id ), ARRAY_A );
2243
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2244
- $exists = $wpdb->get_var ( $wpdb->prepare ( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_photos WHERE `filename` = %s AND `album` = %s", $photo['filename'], $newalb ) );
2245
  if ( $exists ) { // Already exists
2246
  wppa_error_message ( sprintf ( __( 'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photo['filename'], $newalb ) );
2247
  $skip = true;
@@ -2250,16 +2259,19 @@ function wppa_album_photos_bulk( $album ) {
2250
  if ( $skip ) continue;
2251
  wppa_invalidate_treecounts( $photo['album'] ); // Current album
2252
  wppa_invalidate_treecounts( $newalb ); // New album
2253
- $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `album` = %s WHERE `id` = %s', $newalb, $id ) );
 
 
2254
  wppa_move_source( $photo['filename'], $photo['album'], $newalb );
2255
  }
2256
  else wppa_error_message( 'Unexpected error #4 in wppa_album_photos_bulk().' );
2257
  break;
2258
  case 'wppa-bulk-copy-to':
2259
  if ( $newalb ) {
2260
- $photo = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_PHOTOS.' WHERE `id` = %s', $id ), ARRAY_A );
 
2261
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2262
- $exists = $wpdb->get_var ( $wpdb->prepare ( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_photos WHERE `filename` = %s AND `album` = %s", $photo['filename'], $newalb ) );
2263
  if ( $exists ) { // Already exists
2264
  wppa_error_message ( sprintf ( __( $exists.'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photo['filename'], $newalb ) );
2265
  $skip = true;
@@ -2278,7 +2290,7 @@ function wppa_album_photos_bulk( $album ) {
2278
  }
2279
  if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
2280
  if ( $status == 'publish' || $status == 'pending' || wppa_user_is( 'administrator' ) || ! wppa_switch( 'ext_status_restricted' ) ) {
2281
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos SET `status` = %s WHERE `id` = %d", $status, $id ) );
2282
  wppa_invalidate_treecounts( wppa_get_photo_item( $id, 'album' ) );
2283
  }
2284
  else wp_die( 'Security check failure 2' );
@@ -2291,7 +2303,7 @@ function wppa_album_photos_bulk( $album ) {
2291
  $owner = sanitize_user( $owner );
2292
  $exists = $wpdb->get_var( "SELECT COUNT(*) FROM `".$wpdb->users."` WHERE `user_login` = '".$owner."'" );
2293
  if ( $exists ) {
2294
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos SET `owner` = %s WHERE `id` = %d", $owner, $id ) );
2295
  }
2296
  else {
2297
  wppa_error_message( 'A user with login name '.$owner.' does not exist.' );
@@ -2350,9 +2362,9 @@ function wppa_album_photos_bulk( $album ) {
2350
 
2351
  if ( $album ) {
2352
  if ( $album == 'moderate' ) {
2353
- $count = $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_photos WHERE status = 'pending'" );
2354
 
2355
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
2356
  WHERE status = 'pending'
2357
  ORDER BY album DESC, timestamp DESC
2358
  LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
@@ -2367,10 +2379,10 @@ function wppa_album_photos_bulk( $album ) {
2367
  wppa_show_search_statistics();
2368
  }
2369
  else {
2370
- $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_photos
2371
  WHERE album = %s", $album ) );
2372
 
2373
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
2374
  WHERE album = %s
2375
  " . wppa_get_photo_order( $album ) . "
2376
  LIMIT %d, %d", $album, $skip, $pagesize ), ARRAY_A );
@@ -2877,7 +2889,7 @@ global $wpdb;
2877
  $is_descending = strpos( $photoorder, 'DESC' ) !== false;
2878
  $is_p_order = strpos( $photoorder, 'p_order' ) !== false;
2879
 
2880
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos
2881
  WHERE album = %s" . $photoorder, $album ), ARRAY_A );
2882
 
2883
  $link = wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album.'&bulk'.'&wppa_nonce=' . wp_create_nonce('wppa_nonce') );
@@ -3116,7 +3128,7 @@ global $wppa_search_stats;
3116
  $pword = $wpdb->esc_like( $word ) . '%';
3117
  }
3118
  $pidxs = $wpdb->get_results( $wpdb->prepare( "SELECT slug, photos
3119
- FROM {$wpdb->prefix}wppa_index
3120
  WHERE slug LIKE %s", $pword ), ARRAY_A );
3121
  $photos = array();
3122
 
@@ -3138,7 +3150,7 @@ global $wppa_search_stats;
3138
  $u = wppa_get_user();
3139
  foreach( array_keys( $photo_array ) as $k ) {
3140
  $id = $photo_array[$k];
3141
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM {$wpdb->prefix}wppa_photos WHERE id = %d", $id ) ) != $u ) {
3142
  unset( $photo_array[$k] );
3143
  }
3144
  }
@@ -3164,7 +3176,7 @@ global $wppa_search_stats;
3164
  $u = wppa_get_user();
3165
  foreach( array_keys( $temp_array ) as $k ) {
3166
  $id = $temp_array[$k];
3167
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM {$wpdb->prefix}wppa_photos WHERE id = %d", $id ) ) != $u ) {
3168
  unset( $temp_array[$k] );
3169
  }
3170
  }
@@ -3190,7 +3202,7 @@ global $wppa_search_stats;
3190
  $u = wppa_get_user();
3191
  foreach( array_keys( $photo_array ) as $k ) {
3192
  $id = $photo_array[$k];
3193
- if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM {$wpdb->prefix}wppa_photos WHERE id = %d", $id ) ) != $u ) {
3194
  unset( $photo_array[$k] );
3195
  }
3196
  }
@@ -3211,7 +3223,7 @@ global $wppa_search_stats;
3211
  $s--;
3212
  }
3213
  elseif( $l ) {
3214
- $photos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_photos WHERE id = %d", $id ), ARRAY_A );
3215
  $l--;
3216
  }
3217
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 6.9.20
7
  *
8
  */
9
 
108
 
109
  // Edit trashed photos
110
  elseif ( $album == 'trash' ) {
111
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
112
  WHERE album < '0' ORDER BY modified DESC
113
  LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
114
  $count = is_array( $photos ) ? count( $photos ) : 0;
124
  elseif ( $album == 'single' ) {
125
  $p = strval( intval( $_REQUEST['photo'] ) );
126
  $count = $p ? 1 : 0;
127
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
128
  WHERE id = %d", $p ), ARRAY_A );
129
  $count = is_array( $photos ) ? count( $photos ) : 0;
130
  $link = '';
134
  else {
135
  $counts = wppa_get_treecounts_a( $album, true );
136
  $count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
137
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
138
  WHERE album = %s
139
  " . wppa_get_photo_order( $album ) . "
140
  LIMIT %d, %d", $album, $skip, $pagesize ), ARRAY_A );
151
  // Edit a single photo
152
  elseif ( $photo && ! $moderate ) {
153
  $count = '1';
154
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
155
  WHERE id = %s", $photo ), ARRAY_A );
156
  $link = '';
157
  }
158
 
159
  // Edit the photos of a specific owner
160
  elseif ( $owner ) {
161
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
162
  WHERE owner = %s
163
  ORDER BY timestamp DESC
164
  LIMIT %d, %d", $owner, $skip, $pagesize ), ARRAY_A );
176
 
177
  // Moderate a single photo
178
  if ( $photo ) {
179
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
180
+ WHERE id = %s", $photo ), ARRAY_A );
181
  $count = is_array( $photos ) ? count( $photos ) : 0;
182
  $link = '';
183
  }
186
  else {
187
 
188
  // Find pending comments
189
+ $cmt = $wpdb->get_results( "SELECT photo FROM $wpdb->wppa_comments
190
  WHERE status = 'pending'
191
  OR `status` = 'spam'", ARRAY_A );
192
 
197
  $cmt = array_unique( $cmt );
198
 
199
  foreach( $cmt as $id ) {
200
+ $photos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
201
  WHERE id = %d", $id ), ARRAY_A );
202
  }
203
+ $count = count( $photos );
204
  }
205
  $link = wppa_dbg_url( get_admin_url() . 'admin.php' . '?page=wppa_moderate_photos' . '&wppa_nonce=' . wp_create_nonce('wppa_nonce') );
206
  }
207
 
208
+ // Are there photos to moderate?
209
+ if ( empty( $photos ) ) {
210
+
211
+ $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
212
+ WHERE status = 'pending'", ARRAY_A );
213
+ $count = count( $photos );
214
+ }
215
+
216
  // No photos to moderate
217
  if ( empty( $photos ) ) {
218
 
239
  __( 'Manage all photos by timestamp' , 'wp-photo-album-plus') .
240
  '</h3>';
241
 
242
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
243
  ORDER BY `timestamp` DESC
244
  LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
245
 
2065
 
2066
  // Exif
2067
  if ( ! $quick ) {
2068
+ $exifs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif
2069
  WHERE photo = %s
2070
  ORDER BY tag, id", $id ), ARRAY_A );
2071
  if ( ! empty( $exifs ) ) {
2136
 
2137
  // Comments
2138
  if ( ! $quick ) {
2139
+ $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments
2140
  WHERE photo = %s
2141
  ORDER BY timestamp DESC ", $id ), ARRAY_A );
2142
  if ( ! empty( $comments ) ) {
2248
  break;
2249
  case 'wppa-bulk-move-to':
2250
  if ( $newalb ) {
2251
+ $photo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE `id` = %s", $id ), ARRAY_A );
2252
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2253
+ $exists = $wpdb->get_var ( $wpdb->prepare ( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE `filename` = %s AND `album` = %s", $photo['filename'], $newalb ) );
2254
  if ( $exists ) { // Already exists
2255
  wppa_error_message ( sprintf ( __( 'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photo['filename'], $newalb ) );
2256
  $skip = true;
2259
  if ( $skip ) continue;
2260
  wppa_invalidate_treecounts( $photo['album'] ); // Current album
2261
  wppa_invalidate_treecounts( $newalb ); // New album
2262
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
2263
+ SET album = %d
2264
+ WHERE id = %d", $newalb, $id ) );
2265
  wppa_move_source( $photo['filename'], $photo['album'], $newalb );
2266
  }
2267
  else wppa_error_message( 'Unexpected error #4 in wppa_album_photos_bulk().' );
2268
  break;
2269
  case 'wppa-bulk-copy-to':
2270
  if ( $newalb ) {
2271
+ $photo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
2272
+ WHERE id = %d", $id ), ARRAY_A );
2273
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2274
+ $exists = $wpdb->get_var ( $wpdb->prepare ( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE `filename` = %s AND `album` = %s", $photo['filename'], $newalb ) );
2275
  if ( $exists ) { // Already exists
2276
  wppa_error_message ( sprintf ( __( $exists.'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photo['filename'], $newalb ) );
2277
  $skip = true;
2290
  }
2291
  if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
2292
  if ( $status == 'publish' || $status == 'pending' || wppa_user_is( 'administrator' ) || ! wppa_switch( 'ext_status_restricted' ) ) {
2293
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos SET `status` = %s WHERE `id` = %d", $status, $id ) );
2294
  wppa_invalidate_treecounts( wppa_get_photo_item( $id, 'album' ) );
2295
  }
2296
  else wp_die( 'Security check failure 2' );
2303
  $owner = sanitize_user( $owner );
2304
  $exists = $wpdb->get_var( "SELECT COUNT(*) FROM `".$wpdb->users."` WHERE `user_login` = '".$owner."'" );
2305
  if ( $exists ) {
2306
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos SET `owner` = %s WHERE `id` = %d", $owner, $id ) );
2307
  }
2308
  else {
2309
  wppa_error_message( 'A user with login name '.$owner.' does not exist.' );
2362
 
2363
  if ( $album ) {
2364
  if ( $album == 'moderate' ) {
2365
+ $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE status = 'pending'" );
2366
 
2367
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
2368
  WHERE status = 'pending'
2369
  ORDER BY album DESC, timestamp DESC
2370
  LIMIT %d, %d", $skip, $pagesize ), ARRAY_A );
2379
  wppa_show_search_statistics();
2380
  }
2381
  else {
2382
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos
2383
  WHERE album = %s", $album ) );
2384
 
2385
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
2386
  WHERE album = %s
2387
  " . wppa_get_photo_order( $album ) . "
2388
  LIMIT %d, %d", $album, $skip, $pagesize ), ARRAY_A );
2889
  $is_descending = strpos( $photoorder, 'DESC' ) !== false;
2890
  $is_p_order = strpos( $photoorder, 'p_order' ) !== false;
2891
 
2892
+ $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
2893
  WHERE album = %s" . $photoorder, $album ), ARRAY_A );
2894
 
2895
  $link = wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album.'&bulk'.'&wppa_nonce=' . wp_create_nonce('wppa_nonce') );
3128
  $pword = $wpdb->esc_like( $word ) . '%';
3129
  }
3130
  $pidxs = $wpdb->get_results( $wpdb->prepare( "SELECT slug, photos
3131
+ FROM $wpdb->wppa_index
3132
  WHERE slug LIKE %s", $pword ), ARRAY_A );
3133
  $photos = array();
3134
 
3150
  $u = wppa_get_user();
3151
  foreach( array_keys( $photo_array ) as $k ) {
3152
  $id = $photo_array[$k];
3153
+ if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3154
  unset( $photo_array[$k] );
3155
  }
3156
  }
3176
  $u = wppa_get_user();
3177
  foreach( array_keys( $temp_array ) as $k ) {
3178
  $id = $temp_array[$k];
3179
+ if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3180
  unset( $temp_array[$k] );
3181
  }
3182
  }
3202
  $u = wppa_get_user();
3203
  foreach( array_keys( $photo_array ) as $k ) {
3204
  $id = $photo_array[$k];
3205
+ if ( $wpdb->get_var( $wpdb->prepare( "SELECT owner FROM $wpdb->wppa_photos WHERE id = %d", $id ) ) != $u ) {
3206
  unset( $photo_array[$k] );
3207
  }
3208
  }
3223
  $s--;
3224
  }
3225
  elseif( $l ) {
3226
+ $photos[] = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE id = %d", $id ), ARRAY_A );
3227
  $l--;
3228
  }
3229
  }
wppa-session.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all session routines
6
- * Version 6.9.16
7
  *
8
  * Firefox modifies data in the superglobal $_SESSION.
9
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
@@ -37,7 +37,7 @@ global $wppa_session;
37
  $expire = time() - $lifetime;
38
 
39
  // Is session already started?
40
- $session = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wppa_session
41
  WHERE session = %s
42
  AND status = 'valid'
43
  LIMIT 1", wppa_get_session_id() ), ARRAY_A );
@@ -46,13 +46,13 @@ global $wppa_session;
46
  if ( $session ) {
47
  if ( $session['timestamp'] < $expire ) {
48
 
49
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_session
50
  SET status = 'expired'
51
  WHERE id = %d", $session['id'] ) );
52
  $session = false;
53
 
54
  // Anonimize all expired sessions, except robots (for the statistics widget)
55
- $wpdb->query( "UPDATE {$wpdb->prefix}wppa_session
56
  SET ip = '', user = '', data = ''
57
  WHERE status = 'expired'
58
  AND data NOT LIKE '%\"isrobot\";b:1;%'" );
@@ -99,7 +99,7 @@ global $wppa_session;
99
  else {
100
  $wppa_session = wppa_unserialize( $data, true );
101
 
102
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_session
103
  SET count = %d WHERE id = %d", $session['count'] + '1', $session['id'] ) );
104
  }
105
 
@@ -195,7 +195,7 @@ static $last_query;
195
  }
196
 
197
  // Compose the query
198
- $query = $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_session
199
  SET data = %s
200
  WHERE id = %d", serialize( $wppa_session ), $wppa_session['id'] );
201
 
@@ -232,7 +232,7 @@ function wppa_extend_session() {
232
  global $wpdb;
233
 
234
  $sessionid = wppa_get_session_id();
235
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_session
236
  SET timestamp = %d
237
  WHERE session = %s", time(), $sessionid ) );
238
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all session routines
6
+ * Version 6.9.20
7
  *
8
  * Firefox modifies data in the superglobal $_SESSION.
9
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
37
  $expire = time() - $lifetime;
38
 
39
  // Is session already started?
40
+ $session = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_session
41
  WHERE session = %s
42
  AND status = 'valid'
43
  LIMIT 1", wppa_get_session_id() ), ARRAY_A );
46
  if ( $session ) {
47
  if ( $session['timestamp'] < $expire ) {
48
 
49
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session
50
  SET status = 'expired'
51
  WHERE id = %d", $session['id'] ) );
52
  $session = false;
53
 
54
  // Anonimize all expired sessions, except robots (for the statistics widget)
55
+ $wpdb->query( "UPDATE $wpdb->wppa_session
56
  SET ip = '', user = '', data = ''
57
  WHERE status = 'expired'
58
  AND data NOT LIKE '%\"isrobot\";b:1;%'" );
99
  else {
100
  $wppa_session = wppa_unserialize( $data, true );
101
 
102
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session
103
  SET count = %d WHERE id = %d", $session['count'] + '1', $session['id'] ) );
104
  }
105
 
195
  }
196
 
197
  // Compose the query
198
+ $query = $wpdb->prepare( "UPDATE $wpdb->wppa_session
199
  SET data = %s
200
  WHERE id = %d", serialize( $wppa_session ), $wppa_session['id'] );
201
 
232
  global $wpdb;
233
 
234
  $sessionid = wppa_get_session_id();
235
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session
236
  SET timestamp = %d
237
  WHERE session = %s", time(), $sessionid ) );
238
  }
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 6.9.19
7
  *
8
  */
9
 
@@ -30,7 +30,7 @@ global $wppa_supported_camara_brands;
30
  /*
31
  echo '<input type="button" vaue="Click me" onclick="wppaTimedConfirm( \'My Text\' )" />';
32
  *//*
33
- $session = $wpdb->get_row("SELECT * FROM {$wpdb->prefix}wppa_session ORDER BY id DESC LIMIT 1", ARRAY_A );
34
  echo $session['data'].'<br /><br />';
35
  var_dump ( unserialize($session['data']));
36
  echo '<br /><br />';
@@ -266,16 +266,16 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
266
  } // wppa-settings-submit
267
 
268
  // Fix invalid ratings
269
- $iret = $wpdb->query( "DELETE FROM `" . WPPA_RATING . "` WHERE `value` = 0" );
270
  if ( $iret ) wppa_update_message( sprintf( __( '%s invalid ratings removed. Please run Table VIII-A5: Rerate to fix the averages.' , 'wp-photo-album-plus'), $iret ) );
271
 
272
  // Fix invalid source path
273
  wppa_fix_source_path();
274
 
275
  // Cleanup obsolete settings
276
- if ( $wpdb->get_var( "SELECT COUNT(*) FROM {$wpdb->prefix}options
277
  WHERE option_name LIKE 'wppa_last_album_used-%'" ) > 100 ) {
278
- $iret = $wpdb->query( "DELETE FROM {$wpdb->prefix}options
279
  WHERE option_name LIKE 'wppa_last_album_used-%'" );
280
  wppa_update_message( sprintf( __( '%s last album used settings removed.', 'wp-photo-album-plus'), $iret ) );
281
  }
@@ -10615,7 +10615,7 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
10615
 
10616
  $wppa_subtable = 'Z';
10617
 
10618
- $labels = $wpdb->get_results( "SELECT * FROM `" . WPPA_IPTC . "` WHERE `photo` = '0' ORDER BY `tag`", ARRAY_A );
10619
  if ( is_array( $labels ) ) {
10620
  $i = '1';
10621
  foreach ( $labels as $label ) {
@@ -10683,7 +10683,7 @@ var_dump ( json_decode( json_encode( unserialize( $session['data'] ) )));
10683
  '<b></span>');
10684
  }
10685
 
10686
- $labels = $wpdb->get_results( "SELECT * FROM `" . WPPA_EXIF . "` WHERE `photo` = '0' ORDER BY `tag`", ARRAY_A);
10687
  if ( is_array( $labels ) ) {
10688
  $i = '1';
10689
  foreach ( $labels as $label ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 6.9.20
7
  *
8
  */
9
 
30
  /*
31
  echo '<input type="button" vaue="Click me" onclick="wppaTimedConfirm( \'My Text\' )" />';
32
  *//*
33
+ $session = $wpdb->get_row("SELECT * FROM $wpdb->wppa_session ORDER BY id DESC LIMIT 1", ARRAY_A );
34
  echo $session['data'].'<br /><br />';
35
  var_dump ( unserialize($session['data']));
36
  echo '<br /><br />';
266
  } // wppa-settings-submit
267
 
268
  // Fix invalid ratings
269
+ $iret = $wpdb->query( "DELETE FROM $wpdb->wppa_rating WHERE value = 0" );
270
  if ( $iret ) wppa_update_message( sprintf( __( '%s invalid ratings removed. Please run Table VIII-A5: Rerate to fix the averages.' , 'wp-photo-album-plus'), $iret ) );
271
 
272
  // Fix invalid source path
273
  wppa_fix_source_path();
274
 
275
  // Cleanup obsolete settings
276
+ if ( $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->options
277
  WHERE option_name LIKE 'wppa_last_album_used-%'" ) > 100 ) {
278
+ $iret = $wpdb->query( "DELETE FROM $wpdb->options
279
  WHERE option_name LIKE 'wppa_last_album_used-%'" );
280
  wppa_update_message( sprintf( __( '%s last album used settings removed.', 'wp-photo-album-plus'), $iret ) );
281
  }
10615
 
10616
  $wppa_subtable = 'Z';
10617
 
10618
+ $labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_iptc WHERE photo = '0' ORDER BY tag", ARRAY_A );
10619
  if ( is_array( $labels ) ) {
10620
  $i = '1';
10621
  foreach ( $labels as $label ) {
10683
  '<b></span>');
10684
  }
10685
 
10686
+ $labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_exif WHERE photo = '0' ORDER BY tag", ARRAY_A );
10687
  if ( is_array( $labels ) ) {
10688
  $i = '1';
10689
  foreach ( $labels as $label ) {
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -78,7 +78,7 @@ global $silent;
78
  PRIMARY KEY (id)
79
  ) DEFAULT CHARACTER SET utf8;";
80
 
81
- $create_photos = "CREATE TABLE " . WPPA_PHOTOS . " (
82
  id bigint(20) NOT NULL,
83
  album bigint(20) NOT NULL,
84
  ext tinytext NOT NULL,
@@ -250,10 +250,12 @@ global $silent;
250
  wppa_copy_setting('wppa_fontweight_numbar', 'wppa_fontweight_numbar_active');
251
  }
252
  if ( $old_rev <= '455') { // rating_count added to WPPA_PHOTOS
253
- $phs = $wpdb->get_results( 'SELECT `id` FROM `'.WPPA_PHOTOS.'`', ARRAY_A );
254
  if ($phs) foreach ($phs as $ph) {
255
  $cnt = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM `'.WPPA_RATING.'` WHERE `photo` = %s', $ph['id']));
256
- $wpdb->query($wpdb->prepare('UPDATE `'.WPPA_PHOTOS.'` SET `rating_count` = %s WHERE `id` = %s', $cnt, $ph['id']));
 
 
257
  }
258
  }
259
  if ( $old_rev < '470' ) { // single photo re-impl. has its own links, clone from slideshow
@@ -274,12 +276,14 @@ global $silent;
274
  }
275
  }
276
  }
277
- $phots = $wpdb->get_results('SELECT `id`, `description` FROM '.WPPA_PHOTOS, ARRAY_A);
278
  if ($phots) {
279
  foreach($phots as $phot) {
280
  $pt++;
281
  if (html_entity_decode($phot['description']) != $phot['description']) {
282
- $wpdb->query($wpdb->prepare('UPDATE `'.WPPA_PHOTOS.'` SET `description` = %s WHERE `id` = %s', html_entity_decode($phot['description']), $phot['id']));
 
 
283
  $ph++;
284
  }
285
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 6.9.20
7
  *
8
  */
9
 
78
  PRIMARY KEY (id)
79
  ) DEFAULT CHARACTER SET utf8;";
80
 
81
+ $create_photos = "CREATE TABLE $wpdb->wppa_photos (
82
  id bigint(20) NOT NULL,
83
  album bigint(20) NOT NULL,
84
  ext tinytext NOT NULL,
250
  wppa_copy_setting('wppa_fontweight_numbar', 'wppa_fontweight_numbar_active');
251
  }
252
  if ( $old_rev <= '455') { // rating_count added to WPPA_PHOTOS
253
+ $phs = $wpdb->get_results( "SELECT id FROM $wpdb->wppa_photos", ARRAY_A );
254
  if ($phs) foreach ($phs as $ph) {
255
  $cnt = $wpdb->get_var($wpdb->prepare('SELECT COUNT(*) FROM `'.WPPA_RATING.'` WHERE `photo` = %s', $ph['id']));
256
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
257
+ SET rating_count = %d
258
+ WHERE id = %d", $cnt, $ph['id'] ) );
259
  }
260
  }
261
  if ( $old_rev < '470' ) { // single photo re-impl. has its own links, clone from slideshow
276
  }
277
  }
278
  }
279
+ $phots = $wpdb->get_results( "SELECT id, description FROM $wpdb->wppa_photos", ARRAY_A);
280
  if ($phots) {
281
  foreach($phots as $phot) {
282
  $pt++;
283
  if (html_entity_decode($phot['description']) != $phot['description']) {
284
+ $wpdb->query($wpdb->prepare( "UPDATE $wpdb->wppa_photos
285
+ SET description = %s
286
+ WHERE id = %d", html_entity_decode( $phot['description'] ), $phot['id'] ) );
287
  $ph++;
288
  }
289
  }
wppa-slideshow.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the slideshow high level functions
6
- * Version 6.9.06
7
  *
8
  */
9
 
@@ -1459,9 +1459,7 @@ function wppa_numberbar( $opt = '' ) {
1459
  $style_active .= 'border:1px solid ' . wppa_opt( 'bcolor_numbar_active' ) . ';';
1460
  }
1461
 
1462
- // if the number of photos is larger than a certain number, only the active ph displays a number, other are dots
1463
  $count = count( $thumbs );
1464
- $high = wppa_opt( 'numbar_max' );
1465
 
1466
  // do the numbers
1467
  foreach ( $thumbs as $tt ) {
@@ -1473,9 +1471,29 @@ function wppa_numberbar( $opt = '' ) {
1473
  ' style="' . ($numid == 0 ? $style_active : $style) . '"' .
1474
  ' onclick="wppaGotoKeepState('.wppa( 'mocc' ).',' . $numid . ');return false;"' .
1475
  ' >' .
1476
- ( $count > $high ? '.' : $numid + 1 ) .
1477
  '</a>'
1478
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1479
  $numid++;
1480
  }
1481
  wppa_out( '</div>' );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the slideshow high level functions
6
+ * Version 6.9.20
7
  *
8
  */
9
 
1459
  $style_active .= 'border:1px solid ' . wppa_opt( 'bcolor_numbar_active' ) . ';';
1460
  }
1461
 
 
1462
  $count = count( $thumbs );
 
1463
 
1464
  // do the numbers
1465
  foreach ( $thumbs as $tt ) {
1471
  ' style="' . ($numid == 0 ? $style_active : $style) . '"' .
1472
  ' onclick="wppaGotoKeepState('.wppa( 'mocc' ).',' . $numid . ');return false;"' .
1473
  ' >' .
1474
+ ( $numid + 1 ) .
1475
  '</a>'
1476
  );
1477
+ if ( $numid == 0 ) {
1478
+ wppa_out( '<span
1479
+ id="wppa-nbar-' . wppa( 'mocc' ) . '-lodots"
1480
+ style="float:left;
1481
+ display:none;
1482
+ background-color:transparent;
1483
+ margin-right:6px;
1484
+ font-weight:bold;"
1485
+ >...</span>' );
1486
+ }
1487
+ if ( $numid == $count - 2 ) {
1488
+ wppa_out( '<span
1489
+ id="wppa-nbar-' . wppa( 'mocc' ) . '-hidots"
1490
+ style="float:left;
1491
+ display:none;
1492
+ background-color:transparent;
1493
+ margin-right:6px;
1494
+ font-weight:bold;"
1495
+ >...</span>' );
1496
+ }
1497
  $numid++;
1498
  }
1499
  wppa_out( '</div>' );
wppa-statistics.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
- * Version 6.9.15
8
  *
9
  */
10
 
@@ -62,19 +62,20 @@ global $wpdb;
62
  else {
63
  if ( current_user_can('wppa_moderate') ) {
64
  $count = $wpdb->get_var($wpdb->prepare(
65
- "SELECT COUNT(*) FROM " . WPPA_PHOTOS . " WHERE album = %s", $id ) );
66
  }
67
  else {
68
- $count = $wpdb->get_var($wpdb->prepare(
69
- "SELECT COUNT(*) FROM " . WPPA_PHOTOS .
70
- " WHERE `album` = %s AND ( ( `status` <> 'pending' AND `status` <> 'scheduled' ) OR owner = %s )",
71
- $id, wppa_get_user() ) );
72
  }
73
  }
74
 
75
  // Substract private photos if not logged in and album given
76
  if ( $id && ! is_user_logged_in() ) {
77
- $count -= $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE `album` = %s AND `status` = 'private' ", $id ) );
 
78
  }
79
  return $count;
80
  }
@@ -88,8 +89,8 @@ global $wpdb;
88
  $count = $treecounts['selfalbums'];
89
  }
90
  else {
91
- $count = $wpdb->get_var($wpdb->prepare(
92
- "SELECT COUNT(*) FROM " . WPPA_ALBUMS . " WHERE a_parent=%s", $id ) );
93
  }
94
  return $count;
95
  }
@@ -100,7 +101,7 @@ global $wpdb;
100
  static $count;
101
 
102
  if ( ! $count ) {
103
- $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->wppa_albums");
104
  }
105
 
106
  return $count;
@@ -155,9 +156,9 @@ global $wpdb;
155
  function wppa_get_youngest_photo_id() {
156
  global $wpdb;
157
 
158
- $result = $wpdb->get_var(
159
- "SELECT `id` FROM `" . WPPA_PHOTOS .
160
- "` WHERE `status` <> 'pending' AND `status` <> 'scheduled' ORDER BY `timestamp` DESC, `id` DESC LIMIT 1" );
161
 
162
  return $result;
163
  }
@@ -167,9 +168,9 @@ function wppa_get_youngest_photo_ids( $n = '3' ) {
167
  global $wpdb;
168
 
169
  if ( ! wppa_is_int( $n ) ) $n = '3';
170
- $result = $wpdb->get_col(
171
- "SELECT `id` FROM `" . WPPA_PHOTOS .
172
- "` WHERE `status` <> 'pending' AND `status` <> 'scheduled' ORDER BY `timestamp` DESC, `id` DESC LIMIT ".$n );
173
 
174
  return $result;
175
  }
@@ -350,7 +351,7 @@ global $wpdb;
350
  if ( $alb ) {
351
  $alb = strval( intval( $alb ) );
352
  }
353
-
354
  // Album id given
355
  if ( $alb ) {
356
 
@@ -364,7 +365,7 @@ global $wpdb;
364
 
365
  // No album id, flush them all
366
  else {
367
- $iret = $wpdb->query( "UPDATE {$wpdb->prefix}wppa_albums SET treecounts = ''" );
368
  if ( ! $iret ) {
369
  wppa_log( 'Dbg', 'Unable to clear all treecounts' );
370
  }
@@ -516,7 +517,7 @@ function wppa_mark_treecounts( $alb ) {
516
  if ( ! wppa_album_exists( $alb ) ) {
517
  return;
518
  }
519
-
520
  // Do it
521
  if ( $alb ) {
522
  $treecounts = wppa_get_treecounts_a( $alb );
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
+ * Version 6.9.20
8
  *
9
  */
10
 
62
  else {
63
  if ( current_user_can('wppa_moderate') ) {
64
  $count = $wpdb->get_var($wpdb->prepare(
65
+ "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE album = %s", $id ) );
66
  }
67
  else {
68
+ $count = $wpdb->get_var($wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos
69
+ WHERE album = %d
70
+ AND ( ( status <> 'pending' AND status <> 'scheduled' )
71
+ OR owner = %s )", $id, wppa_get_user() ) );
72
  }
73
  }
74
 
75
  // Substract private photos if not logged in and album given
76
  if ( $id && ! is_user_logged_in() ) {
77
+ $count -= $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos
78
+ WHERE album = %d AND status = 'private' ", $id ) );
79
  }
80
  return $count;
81
  }
89
  $count = $treecounts['selfalbums'];
90
  }
91
  else {
92
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
93
+ WHERE a_parent = %d", $id ) );
94
  }
95
  return $count;
96
  }
101
  static $count;
102
 
103
  if ( ! $count ) {
104
+ $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums" );
105
  }
106
 
107
  return $count;
156
  function wppa_get_youngest_photo_id() {
157
  global $wpdb;
158
 
159
+ $result = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_photos
160
+ WHERE status <> 'pending' AND status <> 'scheduled'
161
+ ORDER BY timestamp DESC, id DESC LIMIT 1" );
162
 
163
  return $result;
164
  }
168
  global $wpdb;
169
 
170
  if ( ! wppa_is_int( $n ) ) $n = '3';
171
+ $result = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos
172
+ WHERE status <> 'pending' AND status <> 'scheduled'
173
+ ORDER BY timestamp DESC, id DESC LIMIT %d", $n ) );
174
 
175
  return $result;
176
  }
351
  if ( $alb ) {
352
  $alb = strval( intval( $alb ) );
353
  }
354
+
355
  // Album id given
356
  if ( $alb ) {
357
 
365
 
366
  // No album id, flush them all
367
  else {
368
+ $iret = $wpdb->query( "UPDATE $wpdb->wppa_albums SET treecounts = ''" );
369
  if ( ! $iret ) {
370
  wppa_log( 'Dbg', 'Unable to clear all treecounts' );
371
  }
517
  if ( ! wppa_album_exists( $alb ) ) {
518
  return;
519
  }
520
+
521
  // Do it
522
  if ( $alb ) {
523
  $treecounts = wppa_get_treecounts_a( $alb );
wppa-stats-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the stats widget
6
- * Version 6.9.14
7
  *
8
  */
9
  class WppaStatsWidget extends WP_Widget {
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the stats widget
6
+ * Version 6.9.20
7
  *
8
  */
9
  class WppaStatsWidget extends WP_Widget {
wppa-thumbnails.php CHANGED
@@ -5,7 +5,7 @@
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
- * Version 6.9.09
9
  *
10
  */
11
 
@@ -490,7 +490,10 @@ global $wpdb;
490
  '"' .
491
  ' >';
492
 
493
- $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `".WPPA_COMMENTS."` WHERE `photo` = %s AND `status` = 'approved' ORDER BY `timestamp` DESC", $id ), ARRAY_A );
 
 
 
494
  $first = true;
495
  if ( $comments ) foreach ( $comments as $com ) {
496
  $result .= '<h6' .
@@ -731,7 +734,7 @@ global $wpdb;
731
 
732
  // Comcount
733
  if ( wppa_switch( 'thumb_text_comcount' ) ) {
734
- $comcount = $wpdb->get_var( "SELECT COUNT(*) FROM `" . WPPA_COMMENTS ."` WHERE `photo` = " . $id );
735
  if ( $comcount ) {
736
  $result .= '<div' .
737
  ' class="wppa-thumb-text"' .
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
+ * Version 6.9.20
9
  *
10
  */
11
 
490
  '"' .
491
  ' >';
492
 
493
+ $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments
494
+ WHERE photo = %d
495
+ AND status = 'approved'
496
+ ORDER BY timestamp DESC", $id ), ARRAY_A );
497
  $first = true;
498
  if ( $comments ) foreach ( $comments as $com ) {
499
  $result .= '<h6' .
734
 
735
  // Comcount
736
  if ( wppa_switch( 'thumb_text_comcount' ) ) {
737
+ $comcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments WHERE photo = %d", $id ) );
738
  if ( $comcount ) {
739
  $result .= '<div' .
740
  ' class="wppa-thumb-text"' .
wppa-tinymce-photo-front.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-tinymce-photo-front.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
- * Version 6.9.16
6
  *
7
  */
8
 
@@ -52,7 +52,7 @@ global $wppa_js_page_data_file;
52
  if ( wppa_switch( 'photo_shortcode_enabled' ) && ! $done ) {
53
 
54
  // Find an existing photo
55
- $id = $wpdb->get_var( "SELECT `id` FROM " . WPPA_PHOTOS . " WHERE `ext` <> 'xxx' AND `panorama` = 0 ORDER BY `timestamp` DESC LIMIT 1" );
56
 
57
  // Fake we are in a widget, to prevent wppa_get_picture_html() from bumping viewcount
58
  wppa( 'in_widget', true );
2
  /* wppa-tinymce-photo-front.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
+ * Version 6.9.20
6
  *
7
  */
8
 
52
  if ( wppa_switch( 'photo_shortcode_enabled' ) && ! $done ) {
53
 
54
  // Find an existing photo
55
+ $id = $wpdb->get_var( "SELECT `id` FROM $wpdb->wppa_photos WHERE `ext` <> 'xxx' AND `panorama` = 0 ORDER BY `timestamp` DESC LIMIT 1" );
56
 
57
  // Fake we are in a widget, to prevent wppa_get_picture_html() from bumping viewcount
58
  wppa( 'in_widget', true );
wppa-topten-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
- * Version 6.9.17
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
@@ -93,7 +93,7 @@ class TopTenWidget extends WP_Widget {
93
 
94
  // Albums of owner is current logged in user or public?
95
  if ( $album == '-3' ) {
96
- $temp = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}wppa_albums
97
  WHERE owner = '--- public ---'
98
  OR owner = %s
99
  ORDER BY id", wppa_get_user() ), ARRAY_A );
@@ -118,7 +118,7 @@ class TopTenWidget extends WP_Widget {
118
  switch ( $instance['sortby'] ) {
119
 
120
  case 'rating_count':
121
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
122
  WHERE album IN ( aaaa )
123
  AND status IN ( 'gold', 'silver', 'bronze' )
124
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
@@ -126,7 +126,7 @@ class TopTenWidget extends WP_Widget {
126
  break;
127
 
128
  case 'views':
129
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
130
  WHERE album IN ( aaaa )
131
  AND status IN ( 'gold', 'silver', 'bronze' )
132
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
@@ -135,7 +135,7 @@ class TopTenWidget extends WP_Widget {
135
 
136
  // case 'mean_rating':
137
  default:
138
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
139
  WHERE album IN ( aaaa )
140
  AND status IN ( 'gold', 'silver', 'bronze' )
141
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
@@ -150,14 +150,14 @@ class TopTenWidget extends WP_Widget {
150
  switch ( $instance['sortby'] ) {
151
 
152
  case 'rating_count':
153
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
154
  WHERE album IN ( aaaa )
155
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
156
  LIMIT %d";
157
  break;
158
 
159
  case 'views':
160
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
161
  WHERE album IN ( aaaa )
162
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
163
  LIMIT %d";
@@ -165,7 +165,7 @@ class TopTenWidget extends WP_Widget {
165
 
166
  // case 'mean_rating':
167
  default:
168
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
169
  WHERE album IN ( aaaa )
170
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
171
  LIMIT %d";
@@ -182,7 +182,7 @@ class TopTenWidget extends WP_Widget {
182
  switch ( $instance['sortby'] ) {
183
 
184
  case 'rating_count':
185
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
186
  WHERE album > 0
187
  AND status IN ( 'gold', 'silver', 'bronze' )
188
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
@@ -190,7 +190,7 @@ class TopTenWidget extends WP_Widget {
190
  break;
191
 
192
  case 'views':
193
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
194
  WHERE album > 0
195
  AND status IN ( 'gold', 'silver', 'bronze' )
196
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
@@ -199,7 +199,7 @@ class TopTenWidget extends WP_Widget {
199
 
200
  // case 'mean_rating':
201
  default:
202
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
203
  WHERE album > 0
204
  AND status IN ( 'gold', 'silver', 'bronze' )
205
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
@@ -214,14 +214,14 @@ class TopTenWidget extends WP_Widget {
214
  switch ( $instance['sortby'] ) {
215
 
216
  case 'rating_count':
217
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
218
  WHERE album > 0
219
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
220
  LIMIT %d";
221
  break;
222
 
223
  case 'views':
224
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
225
  WHERE album > 0
226
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
227
  LIMIT %d";
@@ -229,7 +229,7 @@ class TopTenWidget extends WP_Widget {
229
 
230
  // case 'mean_rating':
231
  default:
232
- $query = "SELECT * FROM {$wpdb->prefix}wppa_photos
233
  WHERE album > 0
234
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
235
  LIMIT %d";
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
+ * Version 6.9.20
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
93
 
94
  // Albums of owner is current logged in user or public?
95
  if ( $album == '-3' ) {
96
+ $temp = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums
97
  WHERE owner = '--- public ---'
98
  OR owner = %s
99
  ORDER BY id", wppa_get_user() ), ARRAY_A );
118
  switch ( $instance['sortby'] ) {
119
 
120
  case 'rating_count':
121
+ $query = "SELECT * FROM $wpdb->wppa_photos
122
  WHERE album IN ( aaaa )
123
  AND status IN ( 'gold', 'silver', 'bronze' )
124
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
126
  break;
127
 
128
  case 'views':
129
+ $query = "SELECT * FROM $wpdb->wppa_photos
130
  WHERE album IN ( aaaa )
131
  AND status IN ( 'gold', 'silver', 'bronze' )
132
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
135
 
136
  // case 'mean_rating':
137
  default:
138
+ $query = "SELECT * FROM $wpdb->wppa_photos
139
  WHERE album IN ( aaaa )
140
  AND status IN ( 'gold', 'silver', 'bronze' )
141
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
150
  switch ( $instance['sortby'] ) {
151
 
152
  case 'rating_count':
153
+ $query = "SELECT * FROM $wpdb->wppa_photos
154
  WHERE album IN ( aaaa )
155
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
156
  LIMIT %d";
157
  break;
158
 
159
  case 'views':
160
+ $query = "SELECT * FROM $wpdb->wppa_photos
161
  WHERE album IN ( aaaa )
162
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
163
  LIMIT %d";
165
 
166
  // case 'mean_rating':
167
  default:
168
+ $query = "SELECT * FROM $wpdb->wppa_photos
169
  WHERE album IN ( aaaa )
170
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
171
  LIMIT %d";
182
  switch ( $instance['sortby'] ) {
183
 
184
  case 'rating_count':
185
+ $query = "SELECT * FROM $wpdb->wppa_photos
186
  WHERE album > 0
187
  AND status IN ( 'gold', 'silver', 'bronze' )
188
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
190
  break;
191
 
192
  case 'views':
193
+ $query = "SELECT * FROM $wpdb->wppa_photos
194
  WHERE album > 0
195
  AND status IN ( 'gold', 'silver', 'bronze' )
196
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
199
 
200
  // case 'mean_rating':
201
  default:
202
+ $query = "SELECT * FROM $wpdb->wppa_photos
203
  WHERE album > 0
204
  AND status IN ( 'gold', 'silver', 'bronze' )
205
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
214
  switch ( $instance['sortby'] ) {
215
 
216
  case 'rating_count':
217
+ $query = "SELECT * FROM $wpdb->wppa_photos
218
  WHERE album > 0
219
  ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
220
  LIMIT %d";
221
  break;
222
 
223
  case 'views':
224
+ $query = "SELECT * FROM $wpdb->wppa_photos
225
  WHERE album > 0
226
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
227
  LIMIT %d";
229
 
230
  // case 'mean_rating':
231
  default:
232
+ $query = "SELECT * FROM $wpdb->wppa_photos
233
  WHERE album > 0
234
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
235
  LIMIT %d";
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 6.9.19
7
  *
8
  */
9
 
@@ -1328,12 +1328,16 @@ global $wpdb;
1328
 
1329
  // Sanitize arg
1330
  $photo = strval( intval( $photo ) );
1331
- $photoinfo = $wpdb->get_row($wpdb->prepare('SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `id` = %s', $photo), ARRAY_A);
 
1332
 
1333
  // If still in use, refuse deletion
1334
- $in_use = $wpdb->get_row( "SELECT `ID`, `post_title` FROM `" . $wpdb->posts . "` WHERE `post_content` LIKE '%photo=\"$photo\"%' AND `post_status` = 'publish' LIMIT 1", ARRAY_A );
 
 
1335
 
1336
  if ( is_array( $in_use ) ) {
 
1337
  if ( defined( 'DOING_AJAX' ) ) {
1338
  echo
1339
  'ER||0||' .
@@ -1400,7 +1404,7 @@ global $wpdb;
1400
  wppa_index_remove('photo', $photo);
1401
 
1402
  // Delete db entries
1403
- $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_PHOTOS.'` WHERE `id` = %s LIMIT 1', $photo));
1404
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_RATING.'` WHERE `photo` = %s', $photo));
1405
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_COMMENTS.'` WHERE `photo` = %s', $photo));
1406
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_IPTC.'` WHERE `photo` = %s', $photo));
@@ -1630,6 +1634,9 @@ function wppa_is_enum( $var ) {
1630
  return '' === str_replace( array( '0','1','2','3','4','5','6','7','8','9','.' ), '', $var );
1631
  }
1632
 
 
 
 
1633
  function wppa_log( $xtype, $msg, $trace = false, $listuri = false ) {
1634
  global $wppa_session;
1635
  global $wppa_log_file;
@@ -1652,13 +1659,13 @@ global $wppa_log_file;
1652
  case 'c':
1653
  switch ( $u ) {
1654
  case 'r':
1655
- if ( ! wppa_switch( 'log_cron' ) ) {
1656
  return;
1657
  }
1658
  $type = '{span style="color:blue;" }Cron{/span}';
1659
  break;
1660
  case 'o':
1661
- if ( ! wppa_switch( 'log_comments' ) ) {
1662
  return;
1663
  }
1664
  $type = '{span style="color:cyan;" }Com{/span}';
@@ -1666,7 +1673,7 @@ global $wppa_log_file;
1666
  }
1667
  break;
1668
  case 'd':
1669
- if ( ! wppa_switch( 'log_debug' ) ) {
1670
  return;
1671
  }
1672
  $type = '{span style="color:gray;" }Dbg{/span}';
@@ -1677,7 +1684,7 @@ global $wppa_log_file;
1677
  case 'f':
1678
  switch ( $u ) {
1679
  case 's':
1680
- if ( ! wppa_switch( 'log_fso' ) ) {
1681
  return;
1682
  }
1683
  $type = '{span style="color:blue;" }Fso{/span}';
@@ -1713,12 +1720,12 @@ global $wppa_log_file;
1713
  if ( $filesize > 1024000 ) {
1714
 
1715
  // File > 1000kB, shorten it
1716
- $file = wppa_fopen( $wppa_log_file, 'rb' );
1717
  if ( $file ) {
1718
  $buffer = @ fread( $file, $filesize );
1719
  $buffer = substr( $buffer, $filesize - 900*1024 ); // Take ending 900 kB
1720
  fclose( $file );
1721
- $file = wppa_fopen( $wppa_log_file, 'wb' );
1722
  @ fwrite( $file, $buffer );
1723
  @ fclose( $file );
1724
  }
@@ -1726,7 +1733,7 @@ global $wppa_log_file;
1726
  }
1727
 
1728
  // Open for append
1729
- if ( ! $file = wppa_fopen( $wppa_log_file, 'ab' ) ) return; // Unable to open log file
1730
 
1731
  // Write log message
1732
  $msg = strip_tags( $msg );
@@ -2159,13 +2166,13 @@ global $wpdb;
2159
  break;
2160
  case '2#005':
2161
  $tag = '2#005';
2162
- $name = $wpdb->get_var( $wpdb->prepare( "SELECT description FROM {$wpdb->prefix}wppa_iptc
2163
  WHERE photo = %d
2164
  AND tag = %s", $id, $tag ) );
2165
  break;
2166
  case '2#120':
2167
  $tag = '2#120';
2168
- $name = $wpdb->get_var( $wpdb->prepare( "SELECT description FROM {$wpdb->prefix}wppa_iptc
2169
  WHERE photo = %d
2170
  AND tag = %s", $id, $tag ) );
2171
  break;
@@ -2174,14 +2181,14 @@ global $wpdb;
2174
  break;
2175
  }
2176
  if ( ( $name ) || $method == 'none' ) { // Update name
2177
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos
2178
  SET name = %s
2179
  WHERE id = %d", $name, $id ) );
2180
 
2181
  wppa_cache_thumb( 'invalidate', $id ); // Invalidate cache
2182
  }
2183
  if ( ! wppa_switch( 'save_iptc') ) { // He doesn't want to keep the iptc data, so...
2184
- $wpdb->query($wpdb->prepare( "DELETE FROM {$wpdb->prefix}wppa_iptc
2185
  WHERE photo = %d", $id ) );
2186
  }
2187
 
@@ -2212,7 +2219,7 @@ global $wpdb;
2212
  if ( wppa_opt( 'medal_bronze_when' ) || wppa_opt( 'medal_silver_when' ) || wppa_opt( 'medal_gold_when' ) ) {
2213
  $max_score = wppa_opt( 'rating_max' );
2214
 
2215
- $max_ratings = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM {$wpdb->prefix}wppa_rating
2216
  WHERE photo = %d AND value = %s
2217
  AND status = %s", $id, $max_score, 'publish' ) );
2218
 
@@ -2421,7 +2428,7 @@ static $child_cache;
2421
 
2422
  // Get the data
2423
  $result = $alb;
2424
- $children = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM {$wpdb->prefix}wppa_albums
2425
  WHERE a_parent = %s", $alb ), ARRAY_A );
2426
  if ( $children ) foreach ( $children as $child ) {
2427
  $result .= '.' . _wppa_alb_to_enum_children( $child['id'] );
@@ -2495,11 +2502,11 @@ global $wpdb;
2495
 
2496
  // Get rating(like)count
2497
  $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*)
2498
- FROM {$wpdb->prefix}wppa_rating
2499
  WHERE photo = %d", $id ) );
2500
 
2501
  // Update photo
2502
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos
2503
  SET rating_count = %d, mean_rating = 0
2504
  WHERE id = %d". $count, $id ) );
2505
 
@@ -2510,7 +2517,7 @@ global $wpdb;
2510
 
2511
  // Get all ratings for this photo
2512
  $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT value
2513
- FROM {$wpdb->prefix}wppa_rating
2514
  WHERE photo = %d
2515
  AND status = %s", $id, 'publish' ), ARRAY_A );
2516
 
@@ -2538,7 +2545,7 @@ global $wpdb;
2538
  if ( $the_value == '10' ) $the_value = '9.9999999'; // mean_rating is a text field. for sort order reasons we make 10 into 9.99999
2539
 
2540
  // Update photo
2541
- $wpdb->query( $wpdb->prepare( "UPDATE {$wpdb->prefix}wppa_photos
2542
  SET mean_rating = %s, rating_count = %d
2543
  WHERE id = %d", $the_value, $the_count, $id ) );
2544
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 6.9.20
7
  *
8
  */
9
 
1328
 
1329
  // Sanitize arg
1330
  $photo = strval( intval( $photo ) );
1331
+ $photoinfo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1332
+ WHERE id = %d", $photo ), ARRAY_A );
1333
 
1334
  // If still in use, refuse deletion
1335
+ $in_use = $wpdb->get_row( $wpdb->prepare( "SELECT ID, post_title FROM $wpdb->posts
1336
+ WHERE post_content LIKE %s
1337
+ AND post_status = 'publish' LIMIT 1", '%' . $wpdb->esc_like( 'photo="' . $photo . '"' ) . '%' ), ARRAY_A );
1338
 
1339
  if ( is_array( $in_use ) ) {
1340
+
1341
  if ( defined( 'DOING_AJAX' ) ) {
1342
  echo
1343
  'ER||0||' .
1404
  wppa_index_remove('photo', $photo);
1405
 
1406
  // Delete db entries
1407
+ $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_photos WHERE id = %d", $photo ) );
1408
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_RATING.'` WHERE `photo` = %s', $photo));
1409
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_COMMENTS.'` WHERE `photo` = %s', $photo));
1410
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_IPTC.'` WHERE `photo` = %s', $photo));
1634
  return '' === str_replace( array( '0','1','2','3','4','5','6','7','8','9','.' ), '', $var );
1635
  }
1636
 
1637
+ // Log a wppa message.
1638
+ // We use get_option() here to prevent wppa_switch() to generate messages itsself.
1639
+ // Also, we do not use the wppa filesystem function wrappers, to prevent recursive error logging
1640
  function wppa_log( $xtype, $msg, $trace = false, $listuri = false ) {
1641
  global $wppa_session;
1642
  global $wppa_log_file;
1659
  case 'c':
1660
  switch ( $u ) {
1661
  case 'r':
1662
+ if ( get_option( 'wppa_log_cron' ) == 'no' ) {
1663
  return;
1664
  }
1665
  $type = '{span style="color:blue;" }Cron{/span}';
1666
  break;
1667
  case 'o':
1668
+ if ( get_option( 'wppa_log_comments' ) == 'no' ) {
1669
  return;
1670
  }
1671
  $type = '{span style="color:cyan;" }Com{/span}';
1673
  }
1674
  break;
1675
  case 'd':
1676
+ if ( get_option( 'wppa_log_debug' ) == 'no' ) {
1677
  return;
1678
  }
1679
  $type = '{span style="color:gray;" }Dbg{/span}';
1684
  case 'f':
1685
  switch ( $u ) {
1686
  case 's':
1687
+ if ( get_option( 'wppa_log_fso' ) == 'no' ) {
1688
  return;
1689
  }
1690
  $type = '{span style="color:blue;" }Fso{/span}';
1720
  if ( $filesize > 1024000 ) {
1721
 
1722
  // File > 1000kB, shorten it
1723
+ $file = @ fopen( $wppa_log_file, 'rb' );
1724
  if ( $file ) {
1725
  $buffer = @ fread( $file, $filesize );
1726
  $buffer = substr( $buffer, $filesize - 900*1024 ); // Take ending 900 kB
1727
  fclose( $file );
1728
+ $file = @ fopen( $wppa_log_file, 'wb' );
1729
  @ fwrite( $file, $buffer );
1730
  @ fclose( $file );
1731
  }
1733
  }
1734
 
1735
  // Open for append
1736
+ if ( ! $file = fopen( $wppa_log_file, 'ab' ) ) return; // Unable to open log file
1737
 
1738
  // Write log message
1739
  $msg = strip_tags( $msg );
2166
  break;
2167
  case '2#005':
2168
  $tag = '2#005';
2169
+ $name = $wpdb->get_var( $wpdb->prepare( "SELECT description FROM $wpdb->wppa_iptc
2170
  WHERE photo = %d
2171
  AND tag = %s", $id, $tag ) );
2172
  break;
2173
  case '2#120':
2174
  $tag = '2#120';
2175
+ $name = $wpdb->get_var( $wpdb->prepare( "SELECT description FROM $wpdb->wppa_iptc
2176
  WHERE photo = %d
2177
  AND tag = %s", $id, $tag ) );
2178
  break;
2181
  break;
2182
  }
2183
  if ( ( $name ) || $method == 'none' ) { // Update name
2184
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
2185
  SET name = %s
2186
  WHERE id = %d", $name, $id ) );
2187
 
2188
  wppa_cache_thumb( 'invalidate', $id ); // Invalidate cache
2189
  }
2190
  if ( ! wppa_switch( 'save_iptc') ) { // He doesn't want to keep the iptc data, so...
2191
+ $wpdb->query($wpdb->prepare( "DELETE FROM $wpdb->wppa_iptc
2192
  WHERE photo = %d", $id ) );
2193
  }
2194
 
2219
  if ( wppa_opt( 'medal_bronze_when' ) || wppa_opt( 'medal_silver_when' ) || wppa_opt( 'medal_gold_when' ) ) {
2220
  $max_score = wppa_opt( 'rating_max' );
2221
 
2222
+ $max_ratings = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_rating
2223
  WHERE photo = %d AND value = %s
2224
  AND status = %s", $id, $max_score, 'publish' ) );
2225
 
2428
 
2429
  // Get the data
2430
  $result = $alb;
2431
+ $children = $wpdb->get_results( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums
2432
  WHERE a_parent = %s", $alb ), ARRAY_A );
2433
  if ( $children ) foreach ( $children as $child ) {
2434
  $result .= '.' . _wppa_alb_to_enum_children( $child['id'] );
2502
 
2503
  // Get rating(like)count
2504
  $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*)
2505
+ FROM $wpdb->wppa_rating
2506
  WHERE photo = %d", $id ) );
2507
 
2508
  // Update photo
2509
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
2510
  SET rating_count = %d, mean_rating = 0
2511
  WHERE id = %d". $count, $id ) );
2512
 
2517
 
2518
  // Get all ratings for this photo
2519
  $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT value
2520
+ FROM $wpdb->wppa_rating
2521
  WHERE photo = %d
2522
  AND status = %s", $id, 'publish' ), ARRAY_A );
2523
 
2545
  if ( $the_value == '10' ) $the_value = '9.9999999'; // mean_rating is a text field. for sort order reasons we make 10 into 9.99999
2546
 
2547
  // Update photo
2548
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos
2549
  SET mean_rating = %s, rating_count = %d
2550
  WHERE id = %d", $the_value, $the_count, $id ) );
2551
 
wppa-wpdb-insert.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
- * Version 6.9.14
7
  *
8
  */
9
 
@@ -24,7 +24,7 @@ global $wpdb;
24
  ) );
25
 
26
  // WPPA_SESSION is auto increment
27
- $query = $wpdb->prepare( "INSERT INTO `" . WPPA_SESSION ."` (
28
 
29
  `session`,
30
  `timestamp`,
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
+ * Version 6.9.20
7
  *
8
  */
9
 
24
  ) );
25
 
26
  // WPPA_SESSION is auto increment
27
+ $query = $wpdb->prepare( "INSERT INTO $wpdb->wppa_session (
28
 
29
  `session`,
30
  `timestamp`,
wppa-wrappers.php CHANGED
@@ -5,7 +5,7 @@
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
- * Version 6.9.19
9
  *
10
  */
11
 
@@ -30,7 +30,7 @@ function wppa_copy( $from, $to ) {
30
  }
31
  return wppa_move_uploaded_file( $from, $to );
32
  }
33
-
34
  if ( ! wppa_is_path_safe( $from ) ) {
35
  wppa_log( 'War', 'Unsafe from path detected in wppa_copy(): ' . sanitize_text_field( $from ), true );
36
  return false; // For diagnostic purposes, no return here yet
@@ -72,6 +72,19 @@ function wppa_fopen( $file, $mode ) {
72
  return fopen( $file, $mode );
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
  // Utility to check if a given full filepath is safe to manipulate upon
76
  function wppa_is_path_safe( $path ) {
77
  static $safe_roots;
@@ -94,9 +107,7 @@ global $wppa_log_file;
94
  if ( empty( $safe_roots ) ) {
95
 
96
  // The following root dirs are safe, including all their subdirs, to read/write into
97
- $safe_roots = array( WPPA_CONTENT_PATH . '/uploads/wppa',
98
- WPPA_CONTENT_PATH . '/uploads/wppa-source',
99
- WPPA_CONTENT_PATH . '/uploads/wppa-cdn',
100
  WPPA_CONTENT_PATH . '/wppa-depot',
101
  WPPA_CONTENT_PATH . '/' . wppa_opt( 'pl_dirname' ),
102
  WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ),
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
+ * Version 6.9.20
9
  *
10
  */
11
 
30
  }
31
  return wppa_move_uploaded_file( $from, $to );
32
  }
33
+
34
  if ( ! wppa_is_path_safe( $from ) ) {
35
  wppa_log( 'War', 'Unsafe from path detected in wppa_copy(): ' . sanitize_text_field( $from ), true );
36
  return false; // For diagnostic purposes, no return here yet
72
  return fopen( $file, $mode );
73
  }
74
 
75
+ // Wrapper for glob
76
+ function wppa_glob( $pattern, $flags = null ) {
77
+
78
+ // Is path safe?
79
+ $dir = dirname( $pattern );
80
+ if ( ! wppa_is_path_safe( $dir ) ) {
81
+ wppa_log( 'War', 'Unsafe to path detected in wppa_glob(): ' . sanitize_text_field( $pattern ), true );
82
+ return false;
83
+ }
84
+
85
+ return glob( $pattern, $flags );
86
+ }
87
+
88
  // Utility to check if a given full filepath is safe to manipulate upon
89
  function wppa_is_path_safe( $path ) {
90
  static $safe_roots;
107
  if ( empty( $safe_roots ) ) {
108
 
109
  // The following root dirs are safe, including all their subdirs, to read/write into
110
+ $safe_roots = array( WPPA_CONTENT_PATH . '/uploads',
 
 
111
  WPPA_CONTENT_PATH . '/wppa-depot',
112
  WPPA_CONTENT_PATH . '/' . wppa_opt( 'pl_dirname' ),
113
  WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ),
wppa.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
- * Version: 6.9.19.001
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -22,8 +22,8 @@ global $wpdb;
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
- global $wppa_revno; $wppa_revno = '6919'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '6-9-19-001'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime( true );
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
+ * Version: 6.9.20.004
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
+ global $wppa_revno; $wppa_revno = '6920'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '6-9-20-004'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime( true );