WP Photo Album Plus - Version 6.6.09

Version Description

Download this release

Release Info

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

Code changes from version 6.6.08 to 6.6.09

js/wppa-ajax-front.js CHANGED
@@ -3,7 +3,7 @@
3
  // Contains frontend ajax modules
4
  // Dependancies: wppa.js and default wp jQuery library
5
  //
6
- var wppaJsAjaxVersion = '6.6.08';
7
 
8
  var wppaRenderAdd = false;
9
  var wppaWaitForCounter = 0;
@@ -156,6 +156,10 @@ function wppaDoAjaxRender( mocc, ajaxurl, newurl, add, waitfor, addHilite ) {
156
  },
157
  complete: function( xhr, status, newurl ) {
158
  wppaWaitForCounter++;
 
 
 
 
159
  if ( ! wppaRenderModal ) {
160
  jQuery('html, body').animate({ scrollTop: jQuery("#wppa-container-"+mocc).offset().top - 32 - wppaStickyHeaderHeight }, 1000);
161
  }
3
  // Contains frontend ajax modules
4
  // Dependancies: wppa.js and default wp jQuery library
5
  //
6
+ var wppaJsAjaxVersion = '6.6.09';
7
 
8
  var wppaRenderAdd = false;
9
  var wppaWaitForCounter = 0;
156
  },
157
  complete: function( xhr, status, newurl ) {
158
  wppaWaitForCounter++;
159
+
160
+ // In case onload is not executed
161
+ wppaReplaceSvg();
162
+
163
  if ( ! wppaRenderModal ) {
164
  jQuery('html, body').animate({ scrollTop: jQuery("#wppa-container-"+mocc).offset().top - 32 - wppaStickyHeaderHeight }, 1000);
165
  }
js/wppa-ajax-front.min.js CHANGED
@@ -4,7 +4,7 @@
4
  // Dependancies: wppa.js and default wp jQuery library
5
  //
6
 
7
- var wppaJsAjaxVersion='6.6.08';var wppaRenderAdd=false;var wppaWaitForCounter=0;function wppaDoAjaxRender(mocc,ajaxurl,newurl,add,waitfor,addHilite){if(parseInt(waitfor)>0&&waitfor!=wppaWaitForCounter){setTimeout('wppaDoAjaxRender( '+mocc+', \''+ajaxurl+'\', \''+newurl+'\', \''+add+'\', '+waitfor+' )',100);return;}
8
  wppaRenderAdd=add;if(wppaLang!='')ajaxurl+='&lang='+wppaLang;if(wppaAutoColumnWidth[mocc])ajaxurl+='&resp=1';if(addHilite&&_wppaCurIdx[mocc]&&_wppaId[mocc][_wppaCurIdx[mocc]])ajaxurl+='&wppa-hilite='+_wppaId[mocc][_wppaCurIdx[mocc]];if(wppaCanAjaxRender){jQuery.ajax({url:ajaxurl,async:true,type:'GET',timeout:60000,beforeSend:function(xhr){if(_wppaSSRuns[mocc])_wppaStop(mocc);jQuery('#wppa-ajax-spin-'+mocc).css('display','');},success:function(result,status,xhr){if(wppaRenderAdd){jQuery(wppaRenderAdd+result).insertBefore('#wppa-container-'+mocc+'-end');}
9
  else{if(wppaRenderModal){var opt={modal:true,resizable:true,width:wppaGetContainerWidth(mocc),show:{effect:"fadeIn",duration:400},closeText:"",};jQuery('#wppa-modal-container-'+mocc).html(result).dialog(opt).dialog("open");jQuery('.ui-dialog').css({boxShadow:'0px 0px 5px 5px #aaaaaa',borderRadius:wppaBoxRadius+'px',padding:'8px',backgroundColor:wppaModalBgColor,boxSizing:'content-box',zIndex:100000,});jQuery('.ui-dialog-titlebar').css({lineHeight:'0px',height:'32px',});jQuery('.ui-button').css({backgroundImage:wppaModalQuitImg,padding:0,position:'absolute',right:'8px',top:'8px',width:'16px',height:'16px',});jQuery('.ui-button').attr('title','Close');jQuery('.ui-button').on('click',function(){_wppaStop(mocc);});}
10
  else{jQuery('#wppa-container-'+mocc).html(result);}}
@@ -13,7 +13,7 @@ catch(err){try{history.replaceState({page:wppaHis,occur:mocc,type:'html'},"",new
13
  catch(err){wppaConsoleLog('Ajax rendering: History stack update failed','force');}}
14
  if(wppaFirstOccur==0)wppaFirstOccur=mocc;}
15
  wppaUpdateLightboxes();if(typeof(wppaQRUpdate)!='undefined')wppaQRUpdate(newurl);wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);jQuery('#wppa-ajax-spin-'+mocc).css('display','none');var scriptPos=result.indexOf('<script');var scriptPosLast=result.lastIndexOf('<script');if(scriptPos==-1){wppaConsoleLog('Ajax render did NOT contain a script tag','force');}
16
- else{wppaConsoleLog('Ajax render did contain a script tag at position '+scriptPos+' last at '+scriptPosLast,'force');}},error:function(xhr,status,error){wppaConsoleLog('wppaDoAjaxRender failed. Error = '+error+', status = '+status,'force');document.location.href=newurl;wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);},complete:function(xhr,status,newurl){wppaWaitForCounter++;if(!wppaRenderModal){jQuery('html, body').animate({scrollTop:jQuery("#wppa-container-"+mocc).offset().top-32-wppaStickyHeaderHeight},1000);}}});}
17
  else{document.location.href=newurl;wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);}}
18
  function wppaAjaxApprovePhoto(photo){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=approve'+'&photo-id='+photo,async:true,type:'GET',timeout:60000,success:function(result,status,xhr){if(result=='OK'){jQuery('.wppa-approve-'+photo).css('display','none');}
19
  else{alert(result);}},error:function(xhr,status,error){wppaConsoleLog('wppaAjaxApprovePhoto failed. Error = '+error+', status = '+status,'force');},});}
4
  // Dependancies: wppa.js and default wp jQuery library
5
  //
6
 
7
+ var wppaJsAjaxVersion='6.6.09';var wppaRenderAdd=false;var wppaWaitForCounter=0;function wppaDoAjaxRender(mocc,ajaxurl,newurl,add,waitfor,addHilite){if(parseInt(waitfor)>0&&waitfor!=wppaWaitForCounter){setTimeout('wppaDoAjaxRender( '+mocc+', \''+ajaxurl+'\', \''+newurl+'\', \''+add+'\', '+waitfor+' )',100);return;}
8
  wppaRenderAdd=add;if(wppaLang!='')ajaxurl+='&lang='+wppaLang;if(wppaAutoColumnWidth[mocc])ajaxurl+='&resp=1';if(addHilite&&_wppaCurIdx[mocc]&&_wppaId[mocc][_wppaCurIdx[mocc]])ajaxurl+='&wppa-hilite='+_wppaId[mocc][_wppaCurIdx[mocc]];if(wppaCanAjaxRender){jQuery.ajax({url:ajaxurl,async:true,type:'GET',timeout:60000,beforeSend:function(xhr){if(_wppaSSRuns[mocc])_wppaStop(mocc);jQuery('#wppa-ajax-spin-'+mocc).css('display','');},success:function(result,status,xhr){if(wppaRenderAdd){jQuery(wppaRenderAdd+result).insertBefore('#wppa-container-'+mocc+'-end');}
9
  else{if(wppaRenderModal){var opt={modal:true,resizable:true,width:wppaGetContainerWidth(mocc),show:{effect:"fadeIn",duration:400},closeText:"",};jQuery('#wppa-modal-container-'+mocc).html(result).dialog(opt).dialog("open");jQuery('.ui-dialog').css({boxShadow:'0px 0px 5px 5px #aaaaaa',borderRadius:wppaBoxRadius+'px',padding:'8px',backgroundColor:wppaModalBgColor,boxSizing:'content-box',zIndex:100000,});jQuery('.ui-dialog-titlebar').css({lineHeight:'0px',height:'32px',});jQuery('.ui-button').css({backgroundImage:wppaModalQuitImg,padding:0,position:'absolute',right:'8px',top:'8px',width:'16px',height:'16px',});jQuery('.ui-button').attr('title','Close');jQuery('.ui-button').on('click',function(){_wppaStop(mocc);});}
10
  else{jQuery('#wppa-container-'+mocc).html(result);}}
13
  catch(err){wppaConsoleLog('Ajax rendering: History stack update failed','force');}}
14
  if(wppaFirstOccur==0)wppaFirstOccur=mocc;}
15
  wppaUpdateLightboxes();if(typeof(wppaQRUpdate)!='undefined')wppaQRUpdate(newurl);wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);jQuery('#wppa-ajax-spin-'+mocc).css('display','none');var scriptPos=result.indexOf('<script');var scriptPosLast=result.lastIndexOf('<script');if(scriptPos==-1){wppaConsoleLog('Ajax render did NOT contain a script tag','force');}
16
+ else{wppaConsoleLog('Ajax render did contain a script tag at position '+scriptPos+' last at '+scriptPosLast,'force');}},error:function(xhr,status,error){wppaConsoleLog('wppaDoAjaxRender failed. Error = '+error+', status = '+status,'force');document.location.href=newurl;wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);},complete:function(xhr,status,newurl){wppaWaitForCounter++;wppaReplaceSvg();if(!wppaRenderModal){jQuery('html, body').animate({scrollTop:jQuery("#wppa-container-"+mocc).offset().top-32-wppaStickyHeaderHeight},1000);}}});}
17
  else{document.location.href=newurl;wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);}}
18
  function wppaAjaxApprovePhoto(photo){jQuery.ajax({url:wppaAjaxUrl,data:'action=wppa'+'&wppa-action=approve'+'&photo-id='+photo,async:true,type:'GET',timeout:60000,success:function(result,status,xhr){if(result=='OK'){jQuery('.wppa-approve-'+photo).css('display','none');}
19
  else{alert(result);}},error:function(xhr,status,error){wppaConsoleLog('wppaAjaxApprovePhoto failed. Error = '+error+', status = '+status,'force');},});}
js/wppa-utils.js CHANGED
@@ -2,7 +2,7 @@
2
  //
3
  // conatins common vars and functions
4
  //
5
- var wppaJsUtilsVersion = '6.6.06';
6
  var wppaDebug;
7
 
8
  // Trim
@@ -331,12 +331,15 @@ function wppaSvgHtml( image, height, isLightbox, border, none, light, medium, he
331
  ' onload="wppaReplaceSvg()"' +
332
  ' />';
333
 
 
 
 
334
  return result;
335
  }
336
 
337
  // Replace all SVG images with inline SVG tag
338
  function wppaReplaceSvg() {
339
-
340
  jQuery('img.wppa-svg').each(function(){
341
  var $img = jQuery(this);
342
  var imgID = $img.attr('id');
2
  //
3
  // conatins common vars and functions
4
  //
5
+ var wppaJsUtilsVersion = '6.6.09';
6
  var wppaDebug;
7
 
8
  // Trim
331
  ' onload="wppaReplaceSvg()"' +
332
  ' />';
333
 
334
+ // For systems that do not execute onload:
335
+ setTimeout( function() { wppaReplaceSvg(); }, 100 );
336
+
337
  return result;
338
  }
339
 
340
  // Replace all SVG images with inline SVG tag
341
  function wppaReplaceSvg() {
342
+ wppaConsoleLog('Doing ReplaceSvg', 'force');
343
  jQuery('img.wppa-svg').each(function(){
344
  var $img = jQuery(this);
345
  var imgID = $img.attr('id');
js/wppa-utils.min.js CHANGED
@@ -3,7 +3,7 @@
3
  // conatins common vars and functions
4
  //
5
 
6
- var wppaJsUtilsVersion='6.6.06';var wppaDebug;function wppaTrim(str,arg){var result;result=wppaTrimLeft(str,arg);result=wppaTrimRight(result,arg);return result;}
7
  function wppaTrimLeft(str,arg){var result;var strlen;var arglen;var argcount;var i;var done;var oldStr,newStr;switch(typeof(arg)){case'string':result=str;strlen=str.length;arglen=arg.length;while(strlen>=arglen&&result.substr(0,arglen)==arg){result=result.substr(arglen);strlen=result.length;}
8
  break;case'object':done=false;newStr=str;while(!done){i=0;oldStr=newStr;while(i<arg.length){newStr=wppaTrimLeft(newStr,arg[i]);i++;}
9
  done=(oldStr==newStr);}
@@ -41,8 +41,8 @@ var result='<img'+' src="'+src+'"'+
41
  (wppaIsIe?'':' class="wppa-svg"')+' style="'+'height:'+height+';'+'fill:'+fc+';'+'background-color:'+bc+';'+
42
  (radius?'border-radius:'+radius+'%;':'')+
43
  (border?'border:2px solid '+bc+';box-sizing:border-box;':'')+
44
- (wppaIsIe?'':'display:none;')+'text-decoration:none !important;'+'vertical-align:middle;'+'"'+' onload="wppaReplaceSvg()"'+' />';return result;}
45
- function wppaReplaceSvg(){jQuery('img.wppa-svg').each(function(){var $img=jQuery(this);var imgID=$img.attr('id');var imgClass=$img.attr('class');var imgURL=$img.attr('src');var imgStyle=$img.attr('style');imgStyle=imgStyle.replace('display:none','display:inline');jQuery.get(imgURL,function(data){var $svg=jQuery(data).find('svg');if(typeof imgID!=='undefined'){$svg=$svg.attr('id',imgID);}
46
  if(typeof imgClass!=='undefined'){$svg=$svg.attr('class',imgClass+' replaced-svg');}
47
  if(typeof imgStyle!=='undefined'){$svg=$svg.attr('style',imgStyle);}
48
  $svg=$svg.removeAttr('xmlns:a');$img.replaceWith($svg);},'xml');});}
3
  // conatins common vars and functions
4
  //
5
 
6
+ var wppaJsUtilsVersion='6.6.09';var wppaDebug;function wppaTrim(str,arg){var result;result=wppaTrimLeft(str,arg);result=wppaTrimRight(result,arg);return result;}
7
  function wppaTrimLeft(str,arg){var result;var strlen;var arglen;var argcount;var i;var done;var oldStr,newStr;switch(typeof(arg)){case'string':result=str;strlen=str.length;arglen=arg.length;while(strlen>=arglen&&result.substr(0,arglen)==arg){result=result.substr(arglen);strlen=result.length;}
8
  break;case'object':done=false;newStr=str;while(!done){i=0;oldStr=newStr;while(i<arg.length){newStr=wppaTrimLeft(newStr,arg[i]);i++;}
9
  done=(oldStr==newStr);}
41
  (wppaIsIe?'':' class="wppa-svg"')+' style="'+'height:'+height+';'+'fill:'+fc+';'+'background-color:'+bc+';'+
42
  (radius?'border-radius:'+radius+'%;':'')+
43
  (border?'border:2px solid '+bc+';box-sizing:border-box;':'')+
44
+ (wppaIsIe?'':'display:none;')+'text-decoration:none !important;'+'vertical-align:middle;'+'"'+' onload="wppaReplaceSvg()"'+' />';setTimeout(function(){wppaReplaceSvg();},100);return result;}
45
+ function wppaReplaceSvg(){wppaConsoleLog('Doing ReplaceSvg','force');jQuery('img.wppa-svg').each(function(){var $img=jQuery(this);var imgID=$img.attr('id');var imgClass=$img.attr('class');var imgURL=$img.attr('src');var imgStyle=$img.attr('style');imgStyle=imgStyle.replace('display:none','display:inline');jQuery.get(imgURL,function(data){var $svg=jQuery(data).find('svg');if(typeof imgID!=='undefined'){$svg=$svg.attr('id',imgID);}
46
  if(typeof imgClass!=='undefined'){$svg=$svg.attr('class',imgClass+' replaced-svg');}
47
  if(typeof imgStyle!=='undefined'){$svg=$svg.attr('style',imgStyle);}
48
  $svg=$svg.removeAttr('xmlns:a');$img.replaceWith($svg);},'xml');});}
js/wppa.js CHANGED
@@ -2,7 +2,7 @@
2
  //
3
  // conatins common vars and functions
4
  //
5
- var wppaJsVersion = '6.6.08';
6
 
7
  // Important notice:
8
  // All external vars that may be given a value in wppa-non-admin.php must be declared here and not in other front-end js files!!
@@ -283,8 +283,11 @@ function wppaDoInit( autoOnly ) {
283
  });
284
  }
285
  }
286
- // Replave .svg images with svg html
287
- // wppaReplaceSvg();
 
 
 
288
  }
289
 
290
  // Initialize Ajax render partial page content with history update
2
  //
3
  // conatins common vars and functions
4
  //
5
+ var wppaJsVersion = '6.6.09';
6
 
7
  // Important notice:
8
  // All external vars that may be given a value in wppa-non-admin.php must be declared here and not in other front-end js files!!
283
  });
284
  }
285
  }
286
+
287
+ // Replave .svg images with svg html.
288
+ // Looks redundant, but some installations do not execute
289
+ // onload="wppaReplaceSvg()" for unknown reasons
290
+ wppaReplaceSvg();
291
  }
292
 
293
  // Initialize Ajax render partial page content with history update
js/wppa.min.js CHANGED
@@ -3,8 +3,9 @@
3
  // conatins common vars and functions
4
  //
5
 
6
- var wppaJsVersion='6.6.08';var wppaVersion='0';var wppaIsIe=false;var wppaDebug;var wppaFullValign=[];var wppaFullHalign=[];var wppaFullFrameDelta=[];var wppaAnimationSpeed;var wppaImageDirectory;var wppaAutoColumnWidth=[];var wppaAutoColumnFrac=[];var wppaThumbnailAreaDelta;var wppaSlideShowTimeOut=2500;var wppaFadeInAfterFadeOut=false;var wppaTextFrameDelta=0;var wppaBoxDelta=0;var wppaPreambule;var wppaHideWhenEmpty=false;var wppaThumbnailPitch=[];var wppaFilmStripLength=[];var wppaFilmStripMargin=[];var wppaFilmStripAreaDelta=[];var wppaFilmShowGlue=false;var wppaIsMini=[];var wppaPortraitOnly=[];var wppaSlideShow;var wppaPhoto;var wppaOf;var wppaNextPhoto;var wppaPreviousPhoto;var wppaNextP;var wppaPrevP;var wppaAvgRating;var wppaMyRating;var wppaAvgRat;var wppaMyRat;var wppaDislikeMsg;var wppaMiniTreshold=300;var wppaStart='Start';var wppaStop='Stop';var wppaPleaseName;var wppaPleaseEmail;var wppaPleaseComment;var wppaRatingOnce=true;var wppaBGcolorNumbar='transparent';var wppaBcolorNumbar='transparent';var wppaBGcolorNumbarActive='transparent';var wppaBcolorNumbarActive='transparent';var wppaFontFamilyNumbar='';var wppaFontSizeNumbar='';var wppaFontColorNumbar='';var wppaFontWeightNumbar='';var wppaFontFamilyNumbarActive='';var wppaFontSizeNumbarActive='';var wppaFontColorNumbarActive='';var wppaFontWeightNumbarActive='';var wppaNumbarMax='10';var wppaAjaxUrl='';var wppaLang='';var wppaNextOnCallback=false;var wppaStarOpacity=0.2;var wppaSlideWrap=true;var wppaLightBox=[];var wppaEmailRequired='required';var wppaSlideBorderWidth=0;var wppaSlideInitRunning=[];var wppaAnimationType='fadeover';var wppaSlidePause=[];var wppaSlideBlank=[];var wppaRatingMax=5;var wppaRatingDisplayType='graphic';var wppaRatingPrec=2;var wppaFilmPageSize=[];var wppaAspectRatio=[];var wppaFullSize=[];var wppaStretch=false;var wppaThumbSpaceAuto=false;var wppaMinThumbSpace=4;var wppaMagnifierCursor='';var wppaArtMonkyLink='none';var wppaAutoOpenComments=false;var wppaUpdateAddressLine=false;var wppaFilmThumbTitle='';var wppaClickToView='';var wppaUploadUrl='';var wppaVoteForMe='';var wppaVotedForMe='';var wppaSlideSwipe=true;var wppaLightboxSingle=[];var wppaMaxCoverWidth=300;var wppaDownLoad='Download';var wppaSiteUrl='';var wppaWppaUrl='';var wppaIncludeUrl='';var wppaSlideToFullpopup=false;var wppaComAltSize=75;var wppaBumpViewCount=true;var wppaBumpClickCount=false;var wppaFotomoto=false;var wppaArtMonkeyButton=true;var wppaShortQargs=false;var wppaOvlHires=false;var wppaMasonryCols=[];var wppaVideoPlaying=[];var wppaAudioPlaying=[];var wppaSlideVideoStart=false;var wppaSlideAudioStart=false;var wppaAudioHeight=28;var wppaHis=0;var wppaStartHtml=[];var wppaCanAjaxRender=false;var wppaCanPushState=false;var wppaAllowAjax=true;var wppaMaxOccur=0;var wppaFirstOccur=0;var wppaUsePhotoNamesInUrls=false;var wppaShareHideWhenRunning=false;var wppaCommentRequiredAfterVote=true;var wppaTopMoc=0;var wppaColWidth=[];var wppaFotomotoHideWhenRunning=false;var wppaFotomotoMinWidth=400;var wppaPhotoView=[];var wppaBackgroundColorImage='';var wppaPopupLinkType='';var wppaPopupOnclick=[];var wppaThumbTargetBlank=false;var wppaRel='rel';var wppaEditPhotoWidth='960';var wppaThemeStyles='';var wppaStickyHeaderHeight=0;var wppaRenderModal=false;var wppaModalBgColor='#ffffff';var wppaBoxRadius=0;var wppaModalQuitImg;var wppaUploadEdit='none';var wppaPageArg='';var _wppaId=[];var _wppaAvg=[];var _wppaDisc=[];var _wppaMyr=[];var _wppaVRU=[];var _wppaLinkUrl=[];var _wppaLinkTitle=[];var _wppaLinkTarget=[];var _wppaCommentHtml=[];var _wppaIptcHtml=[];var _wppaExifHtml=[];var _wppaToTheSame=false;var _wppaSlides=[];var _wppaNames=[];var _wppaFullNames=[];var _wppaDsc=[];var _wppaOgDsc=[];var _wppaCurIdx=[];var _wppaNxtIdx=[];var _wppaTimeOut=[];var _wppaSSRuns=[];var _wppaFg=[];var _wppaTP=[];var _wppaIsBusy=[];var _wppaFirst=[];var _wppaVoteInProgress=false;var _wppaTextDelay;var _wppaUrl=[];var _wppaSkipRated=[];var _wppaLbTitle=[];var _wppaStateCount=0;var _wppaDidGoto=[];var _wppaShareUrl=[];var _wppaShareHtml=[];var _wppaFilmNoMove=[];var _wppaHiresUrl=[];var _wppaIsVideo=[];var _wppaVideoHtml=[];var _wppaAudioHtml=[];var _wppaVideoNatWidth=[];var _wppaVideoNatHeight=[];var _wppaWaitTexts=[];var _wppaImageAlt=[];var __wppaOverruleRun=false;var wppaOvlUrls;var wppaOvlTitles;var wppaOvlAlts;var wppaOvlIdx=0;var wppaOvlFirst=true;var wppaOvlKbHandler='';var wppaOvlSizeHandler='';var wppaOvlPadTop=5;var wppaOvlIsSingle;var wppaOvlRunning=false;var wppaOvlVideoHtmls;var wppaOvlAudioHtmls;var wppaOvlVideoNaturalWidths;var wppaOvlVideoNaturalHeights;var wppaOvlModeInitial='normal';var wppaOvlVideoPlaying=false;var wppaOvlAudioPlaying=false;var wppaOvlShowLegenda=true;var wppaOvlShowStartStop=true;var wppaOvlRadius=0;var wppaOvlBorderWidth=16;var wppaOvlTxtHeight=36;var wppaOvlOpacity=0.8;var wppaOvlOnclickType='none';var wppaOvlTheme='black';var wppaOvlAnimSpeed=300;var wppaOvlSlideSpeed=3000;var wppaVer4WindowWidth=800;var wppaVer4WindowHeight=600;var wppaOvlFontFamily='Helvetica';var wppaOvlFontSize='10';var wppaOvlFontColor='';var wppaOvlFontWeight='bold';var wppaOvlLineHeight='12';var wppaOvlShowCounter=true;var wppaOvlIsVideo=false;var wppaShowLegenda='';var wppaOvlFsPhotoId=0;var wppaPhotoId=0;var wppaOvlVideoStart=false;var wppaOvlAudioStart=false;var wppaLastIptc='';var wppaLastExif='';var wppaIsMobile=false;var wppaSvgFillcolor='gray';var wppaSvgBgcolor='transparent';var wppaSvgCornerStyle='light';jQuery(document).ready(function(){wppaDoInit(false);setTimeout(function(){wppaDoInit(true);},1000);});function wppaDoInit(autoOnly){var anyAutocol=false;for(mocc=1;mocc<=wppaTopMoc;mocc++){if(wppaAutoColumnWidth[mocc]){wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);anyAutocol=true;}}
7
- if(!autoOnly){_wppaTextDelay=wppaAnimationSpeed;if(wppaFadeInAfterFadeOut)_wppaTextDelay*=2;if(anyAutocol){jQuery(window).resize(function(){for(mocc=1;mocc<=wppaTopMoc;mocc++){if(wppaAutoColumnWidth[mocc]){wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);}}});}}}
 
8
  jQuery(document).ready(function(e){if(wppaAllowAjax&&jQuery.ajax){wppaCanAjaxRender=true;}
9
  if(typeof(history.pushState)!='undefined'){var i=1;while(i<=wppaMaxOccur){wppaStartHtml[i]=jQuery('#wppa-container-'+i).html();i++;}
10
  wppaCanPushState=true;}});function wppaUpdateLightboxes(){if(typeof(wppaInitOverlay)=='function'){wppaInitOverlay();}
3
  // conatins common vars and functions
4
  //
5
 
6
+ var wppaJsVersion='6.6.09';var wppaVersion='0';var wppaIsIe=false;var wppaDebug;var wppaFullValign=[];var wppaFullHalign=[];var wppaFullFrameDelta=[];var wppaAnimationSpeed;var wppaImageDirectory;var wppaAutoColumnWidth=[];var wppaAutoColumnFrac=[];var wppaThumbnailAreaDelta;var wppaSlideShowTimeOut=2500;var wppaFadeInAfterFadeOut=false;var wppaTextFrameDelta=0;var wppaBoxDelta=0;var wppaPreambule;var wppaHideWhenEmpty=false;var wppaThumbnailPitch=[];var wppaFilmStripLength=[];var wppaFilmStripMargin=[];var wppaFilmStripAreaDelta=[];var wppaFilmShowGlue=false;var wppaIsMini=[];var wppaPortraitOnly=[];var wppaSlideShow;var wppaPhoto;var wppaOf;var wppaNextPhoto;var wppaPreviousPhoto;var wppaNextP;var wppaPrevP;var wppaAvgRating;var wppaMyRating;var wppaAvgRat;var wppaMyRat;var wppaDislikeMsg;var wppaMiniTreshold=300;var wppaStart='Start';var wppaStop='Stop';var wppaPleaseName;var wppaPleaseEmail;var wppaPleaseComment;var wppaRatingOnce=true;var wppaBGcolorNumbar='transparent';var wppaBcolorNumbar='transparent';var wppaBGcolorNumbarActive='transparent';var wppaBcolorNumbarActive='transparent';var wppaFontFamilyNumbar='';var wppaFontSizeNumbar='';var wppaFontColorNumbar='';var wppaFontWeightNumbar='';var wppaFontFamilyNumbarActive='';var wppaFontSizeNumbarActive='';var wppaFontColorNumbarActive='';var wppaFontWeightNumbarActive='';var wppaNumbarMax='10';var wppaAjaxUrl='';var wppaLang='';var wppaNextOnCallback=false;var wppaStarOpacity=0.2;var wppaSlideWrap=true;var wppaLightBox=[];var wppaEmailRequired='required';var wppaSlideBorderWidth=0;var wppaSlideInitRunning=[];var wppaAnimationType='fadeover';var wppaSlidePause=[];var wppaSlideBlank=[];var wppaRatingMax=5;var wppaRatingDisplayType='graphic';var wppaRatingPrec=2;var wppaFilmPageSize=[];var wppaAspectRatio=[];var wppaFullSize=[];var wppaStretch=false;var wppaThumbSpaceAuto=false;var wppaMinThumbSpace=4;var wppaMagnifierCursor='';var wppaArtMonkyLink='none';var wppaAutoOpenComments=false;var wppaUpdateAddressLine=false;var wppaFilmThumbTitle='';var wppaClickToView='';var wppaUploadUrl='';var wppaVoteForMe='';var wppaVotedForMe='';var wppaSlideSwipe=true;var wppaLightboxSingle=[];var wppaMaxCoverWidth=300;var wppaDownLoad='Download';var wppaSiteUrl='';var wppaWppaUrl='';var wppaIncludeUrl='';var wppaSlideToFullpopup=false;var wppaComAltSize=75;var wppaBumpViewCount=true;var wppaBumpClickCount=false;var wppaFotomoto=false;var wppaArtMonkeyButton=true;var wppaShortQargs=false;var wppaOvlHires=false;var wppaMasonryCols=[];var wppaVideoPlaying=[];var wppaAudioPlaying=[];var wppaSlideVideoStart=false;var wppaSlideAudioStart=false;var wppaAudioHeight=28;var wppaHis=0;var wppaStartHtml=[];var wppaCanAjaxRender=false;var wppaCanPushState=false;var wppaAllowAjax=true;var wppaMaxOccur=0;var wppaFirstOccur=0;var wppaUsePhotoNamesInUrls=false;var wppaShareHideWhenRunning=false;var wppaCommentRequiredAfterVote=true;var wppaTopMoc=0;var wppaColWidth=[];var wppaFotomotoHideWhenRunning=false;var wppaFotomotoMinWidth=400;var wppaPhotoView=[];var wppaBackgroundColorImage='';var wppaPopupLinkType='';var wppaPopupOnclick=[];var wppaThumbTargetBlank=false;var wppaRel='rel';var wppaEditPhotoWidth='960';var wppaThemeStyles='';var wppaStickyHeaderHeight=0;var wppaRenderModal=false;var wppaModalBgColor='#ffffff';var wppaBoxRadius=0;var wppaModalQuitImg;var wppaUploadEdit='none';var wppaPageArg='';var _wppaId=[];var _wppaAvg=[];var _wppaDisc=[];var _wppaMyr=[];var _wppaVRU=[];var _wppaLinkUrl=[];var _wppaLinkTitle=[];var _wppaLinkTarget=[];var _wppaCommentHtml=[];var _wppaIptcHtml=[];var _wppaExifHtml=[];var _wppaToTheSame=false;var _wppaSlides=[];var _wppaNames=[];var _wppaFullNames=[];var _wppaDsc=[];var _wppaOgDsc=[];var _wppaCurIdx=[];var _wppaNxtIdx=[];var _wppaTimeOut=[];var _wppaSSRuns=[];var _wppaFg=[];var _wppaTP=[];var _wppaIsBusy=[];var _wppaFirst=[];var _wppaVoteInProgress=false;var _wppaTextDelay;var _wppaUrl=[];var _wppaSkipRated=[];var _wppaLbTitle=[];var _wppaStateCount=0;var _wppaDidGoto=[];var _wppaShareUrl=[];var _wppaShareHtml=[];var _wppaFilmNoMove=[];var _wppaHiresUrl=[];var _wppaIsVideo=[];var _wppaVideoHtml=[];var _wppaAudioHtml=[];var _wppaVideoNatWidth=[];var _wppaVideoNatHeight=[];var _wppaWaitTexts=[];var _wppaImageAlt=[];var __wppaOverruleRun=false;var wppaOvlUrls;var wppaOvlTitles;var wppaOvlAlts;var wppaOvlIdx=0;var wppaOvlFirst=true;var wppaOvlKbHandler='';var wppaOvlSizeHandler='';var wppaOvlPadTop=5;var wppaOvlIsSingle;var wppaOvlRunning=false;var wppaOvlVideoHtmls;var wppaOvlAudioHtmls;var wppaOvlVideoNaturalWidths;var wppaOvlVideoNaturalHeights;var wppaOvlModeInitial='normal';var wppaOvlVideoPlaying=false;var wppaOvlAudioPlaying=false;var wppaOvlShowLegenda=true;var wppaOvlShowStartStop=true;var wppaOvlRadius=0;var wppaOvlBorderWidth=16;var wppaOvlTxtHeight=36;var wppaOvlOpacity=0.8;var wppaOvlOnclickType='none';var wppaOvlTheme='black';var wppaOvlAnimSpeed=300;var wppaOvlSlideSpeed=3000;var wppaVer4WindowWidth=800;var wppaVer4WindowHeight=600;var wppaOvlFontFamily='Helvetica';var wppaOvlFontSize='10';var wppaOvlFontColor='';var wppaOvlFontWeight='bold';var wppaOvlLineHeight='12';var wppaOvlShowCounter=true;var wppaOvlIsVideo=false;var wppaShowLegenda='';var wppaOvlFsPhotoId=0;var wppaPhotoId=0;var wppaOvlVideoStart=false;var wppaOvlAudioStart=false;var wppaLastIptc='';var wppaLastExif='';var wppaIsMobile=false;var wppaSvgFillcolor='gray';var wppaSvgBgcolor='transparent';var wppaSvgCornerStyle='light';jQuery(document).ready(function(){wppaDoInit(false);setTimeout(function(){wppaDoInit(true);},1000);});function wppaDoInit(autoOnly){var anyAutocol=false;for(mocc=1;mocc<=wppaTopMoc;mocc++){if(wppaAutoColumnWidth[mocc]){wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);anyAutocol=true;}}
7
+ if(!autoOnly){_wppaTextDelay=wppaAnimationSpeed;if(wppaFadeInAfterFadeOut)_wppaTextDelay*=2;if(anyAutocol){jQuery(window).resize(function(){for(mocc=1;mocc<=wppaTopMoc;mocc++){if(wppaAutoColumnWidth[mocc]){wppaColWidth[mocc]=0;_wppaDoAutocol(mocc);}}});}}
8
+ wppaReplaceSvg();}
9
  jQuery(document).ready(function(e){if(wppaAllowAjax&&jQuery.ajax){wppaCanAjaxRender=true;}
10
  if(typeof(history.pushState)!='undefined'){var i=1;while(i<=wppaMaxOccur){wppaStartHtml[i]=jQuery('#wppa-container-'+i).html();i++;}
11
  wppaCanPushState=true;}});function wppaUpdateLightboxes(){if(typeof(wppaInitOverlay)=='function'){wppaInitOverlay();}
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, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
5
- Version: 6.6.08
6
- Stable tag: 6.6.08
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
@@ -180,6 +180,31 @@ Oh, just Google on 'picture resizer' and you will find a bunch of free programs
180
 
181
  See for additional information: <a href="http://www.wppa.nl/changelog/" >The documentation website</a>
182
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  = 6.6.08 =
184
 
185
  = Bug Fixes =
@@ -221,7 +246,7 @@ See for additional information: <a href="http://www.wppa.nl/changelog/" >The doc
221
 
222
  * Table IV-A9.2: Track clickcounts. Counts the clicks on single images and slideshow images when there is a link url. Totals per album show up on the album admin page.
223
  * Table VI-B2: Thumbnail linktype: added option: 'the thumbnails album in a slideshow'. Shows the slideshow of the album where the thumbnail belongs. Starting at the pointed image.
224
- This always shows the physical album where the thumbnail belongs to as a slideshow, even when the collection of thumbnails is the content of a virtual album;
225
  as opposed to 'the fullsize photo in a slidshow' (the default) that always shows the slideshow of the selection where the thumbnail belongs to.
226
 
227
  = 6.6.05 =
@@ -246,8 +271,8 @@ as opposed to 'the fullsize photo in a slidshow' (the default) that always shows
246
  * The administrator can now use the downloaded db table .csv-files from Table XII for import on the Photo Albums -> Import screen. For backup and for moving to another website/host.
247
  See http://wppa.nl/changelog/installation-notes/#moving
248
  * Max number of albums to show up in a selectionbox on the photo admin screen is now settable in Table IX-B6.2. If this max is exceeded, a number input field is displayed.
249
- * Maintenance proc Table VIII-B8.2 All to lower. Convert file-extensions to lower case. To fix very old systems.
250
- Recommended before moving the site, especially when you use a windows pc to copy the photofiles.
251
  Window does not accept two files with the same name with different case in file extension. It simply overwrites the files.
252
 
253
  = Other Changes =
@@ -267,7 +292,7 @@ Window does not accept two files with the same name with different case in file
267
 
268
  = Other Changes =
269
 
270
- * Table VII-B7 has been renamed Table VII-B7.0. Table VII-B7.1 added: Front-end uploads get status private.
271
  This overrules the setting of VII-B7.0, but modaretion emails will still be sent if VII-B7.0 is ticked.
272
 
273
  = 6.6.02 =
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, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
5
+ Version: 6.6.09
6
+ Stable tag: 6.6.09
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
180
 
181
  See for additional information: <a href="http://www.wppa.nl/changelog/" >The documentation website</a>
182
 
183
+ = 6.6.09 =
184
+
185
+ = Bug Fixes =
186
+
187
+ * Fixed a spurious db error on certain search ops resulting in erroneously nothing found.
188
+ * Related count was not obeyed. Fixed.
189
+
190
+ = New Features =
191
+
192
+ * Photo viewcounts can now be displayed under the album cover photo. Table II-E9: Viewcount on cover.
193
+ * Table IV-C10: Run nl2br or wpautop on description. For thumbnail text.
194
+
195
+ = Other Changes =
196
+
197
+ * The treecounts system (number of sub-albums, photos, pending and scheduled as well as photo viewcounts)
198
+ has been re-implemented; data is now stored in the albums table.
199
+ Viewing admin pages cause immediate recalculation, so admin pages always show correct numbers.
200
+ On the foreground - to reduce overhead actions that may slow down pageloads for visitors -
201
+ the updates are done in a background process (cron job) and may result in max 30 seconds delay after upload,
202
+ create sub album or viewing fs images.
203
+ * On some systems it has been shown that the eventhandler for onload is not executed on svg images.
204
+ To avoid svg navigation icons from not getting the right colors and showing up,
205
+ the function wppaReplaceSvg() is now called at various smart moments.
206
+ * The album cover text is now wrapped in a div rather than a p to avoid layout problems when Table IV-D8 is set to 'Linebreaks and paragraphs'.
207
+
208
  = 6.6.08 =
209
 
210
  = Bug Fixes =
246
 
247
  * Table IV-A9.2: Track clickcounts. Counts the clicks on single images and slideshow images when there is a link url. Totals per album show up on the album admin page.
248
  * Table VI-B2: Thumbnail linktype: added option: 'the thumbnails album in a slideshow'. Shows the slideshow of the album where the thumbnail belongs. Starting at the pointed image.
249
+ This always shows the physical album where the thumbnail belongs to as a slideshow, even when the collection of thumbnails is the content of a virtual album;
250
  as opposed to 'the fullsize photo in a slidshow' (the default) that always shows the slideshow of the selection where the thumbnail belongs to.
251
 
252
  = 6.6.05 =
271
  * The administrator can now use the downloaded db table .csv-files from Table XII for import on the Photo Albums -> Import screen. For backup and for moving to another website/host.
272
  See http://wppa.nl/changelog/installation-notes/#moving
273
  * Max number of albums to show up in a selectionbox on the photo admin screen is now settable in Table IX-B6.2. If this max is exceeded, a number input field is displayed.
274
+ * Maintenance proc Table VIII-B8.2 All to lower. Convert file-extensions to lower case. To fix very old systems.
275
+ Recommended before moving the site, especially when you use a windows pc to copy the photofiles.
276
  Window does not accept two files with the same name with different case in file extension. It simply overwrites the files.
277
 
278
  = Other Changes =
292
 
293
  = Other Changes =
294
 
295
+ * Table VII-B7 has been renamed Table VII-B7.0. Table VII-B7.1 added: Front-end uploads get status private.
296
  This overrules the setting of VII-B7.0, but modaretion emails will still be sent if VII-B7.0 is ticked.
297
 
298
  = 6.6.02 =
wppa-admin-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
- * Version 6.6.07
7
  *
8
  */
9
 
@@ -299,7 +299,7 @@ global $wpdb;
299
  )
300
  );
301
  if ( ! $id ) return $err;
302
- wppa_flush_treecounts( $album );
303
  wppa_index_add( 'photo', $id );
304
 
305
  $err = '4';
@@ -956,7 +956,7 @@ global $warning_given_small;
956
  else { // Save the source
957
  wppa_save_source( $file, $filename, $alb );
958
  wppa_make_o1_source( $id );
959
- wppa_flush_treecounts( $alb );
960
  wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
961
  wppa_flush_upldr_cache( 'photoid', $id );
962
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
+ * Version 6.6.09
7
  *
8
  */
9
 
299
  )
300
  );
301
  if ( ! $id ) return $err;
302
+ wppa_invalidate_treecounts( $album );
303
  wppa_index_add( 'photo', $id );
304
 
305
  $err = '4';
956
  else { // Save the source
957
  wppa_save_source( $file, $filename, $alb );
958
  wppa_make_o1_source( $id );
959
+ wppa_invalidate_treecounts( $alb );
960
  wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
961
  wppa_flush_upldr_cache( 'photoid', $id );
962
  }
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 6.6.05
6
  *
7
  */
8
 
@@ -290,7 +290,7 @@ global $wppa_log_file;
290
  wppa_flush_upldr_cache( 'photoid', $_REQUEST['photo-id'] );
291
  $alb = $wpdb->get_var( $wpdb->prepare( "SELECT `album` FROM `".WPPA_PHOTOS."` WHERE `id` = %s", $_REQUEST['photo-id'] ) );
292
  wppa_clear_taglist();
293
- wppa_flush_treecounts( $alb );
294
  }
295
  if ( isset( $_REQUEST['comment-id'] ) ) {
296
  $iret = $wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_COMMENTS."` SET `status` = 'approved' WHERE `id` = %s", $_REQUEST['comment-id'] ) );
@@ -753,10 +753,10 @@ global $wppa_log_file;
753
  wppa_create_rating_entry( array( 'photo' => $photo, 'value' => '1', 'user' => $user ) );
754
  $myavgrat = '1';
755
  }
756
-
757
  // Update photo data
758
  wppa_rate_photo( $photo );
759
-
760
  // Get callback data
761
  $lt = wppa_get_like_title_a( $photo );
762
  $allavgratcombi = $lt['title'] . '|' . $lt['display'];
@@ -1123,8 +1123,8 @@ global $wppa_log_file;
1123
  break;
1124
  case 'a_parent':
1125
  $itemname = __( 'Parent album' , 'wp-photo-album-plus');
1126
- wppa_flush_treecounts( $album ); // Myself and my parents
1127
- wppa_flush_treecounts( $value ); // My new parent
1128
  break;
1129
  case 'p_order_by':
1130
  $itemname = __( 'Photo order' , 'wp-photo-album-plus');
@@ -1505,8 +1505,8 @@ global $wppa_log_file;
1505
  wppa_exit();
1506
  break;
1507
  }
1508
- wppa_flush_treecounts( $photodata['album'] ); // Current album
1509
- wppa_flush_treecounts( $value ); // New album
1510
  $iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `album` = %s WHERE `id` = %s', $value, $photo ) );
1511
  if ( $iret !== false ) {
1512
  wppa_move_source( $photodata['filename'], $photodata['album'], $value );
@@ -1534,7 +1534,7 @@ global $wppa_log_file;
1534
  break;
1535
  }
1536
  wppa( 'error', wppa_copy_photo( $photo, $value ) );
1537
- wppa_flush_treecounts( $value ); // New album
1538
  if ( ! wppa( 'error' ) ) {
1539
  echo '||0||'.sprintf( __( 'Photo %s copied to album %s (%s)' , 'wp-photo-album-plus'), $photo, wppa_get_album_name( $value ), $value );
1540
  }
@@ -1547,7 +1547,7 @@ global $wppa_log_file;
1547
 
1548
  case 'status':
1549
  if ( ! current_user_can( 'wppa_moderate' ) && ! current_user_can( 'wppa_admin' ) ) die( 'Security check failure #78' );
1550
- wppa_flush_treecounts( wppa_get_photo_item( $photo, 'album' ) ); // $wpdb->get_var( $wpdb->prepare( "SELECT `album` FROM `".WPPA_PHOTOS."` WHERE `id` = %s", $photo ) ) );
1551
  case 'owner':
1552
  case 'name':
1553
  case 'description':
@@ -1634,7 +1634,7 @@ global $wppa_log_file;
1634
  $iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `'.$item.'` = %s WHERE `id` = %s', $value, $photo ) );
1635
  if ( $item == 'name' || $item == 'description' || $item == 'tags' ) wppa_index_update( 'photo', $photo );
1636
  if ( $item == 'status' && $value != 'scheduled' ) wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => '' ) );
1637
- if ( $item == 'status' ) wppa_flush_treecounts( wppa_get_photo_item( $photo, 'album' ) );
1638
  if ( $iret !== false ) {
1639
  wppa_update_modified( $photo );
1640
  if ( wppa_is_video( $photo ) ) {
@@ -1668,7 +1668,7 @@ global $wppa_log_file;
1668
  if ( $item == 'min' ) $temp[4] = $value;
1669
  $scheduledtm = implode( ',', $temp );
1670
  wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => $scheduledtm, 'status' => 'scheduled' ) );
1671
- wppa_flush_treecounts( $wpdb->get_var( $wpdb->prepare( "SELECT `album` FROM `".WPPA_PHOTOS."` WHERE `id` = %s", $photo ) ) );
1672
  wppa_flush_upldr_cache( 'photoid', $photo );
1673
  if ( wppa_is_video( $photo ) ) {
1674
  echo '||0||'.sprintf( __( '%s of video %s updated' , 'wp-photo-album-plus'), $itemname, $photo );
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 6.6.09
6
  *
7
  */
8
 
290
  wppa_flush_upldr_cache( 'photoid', $_REQUEST['photo-id'] );
291
  $alb = $wpdb->get_var( $wpdb->prepare( "SELECT `album` FROM `".WPPA_PHOTOS."` WHERE `id` = %s", $_REQUEST['photo-id'] ) );
292
  wppa_clear_taglist();
293
+ wppa_invalidate_treecounts( $alb );
294
  }
295
  if ( isset( $_REQUEST['comment-id'] ) ) {
296
  $iret = $wpdb->query( $wpdb->prepare( "UPDATE `".WPPA_COMMENTS."` SET `status` = 'approved' WHERE `id` = %s", $_REQUEST['comment-id'] ) );
753
  wppa_create_rating_entry( array( 'photo' => $photo, 'value' => '1', 'user' => $user ) );
754
  $myavgrat = '1';
755
  }
756
+
757
  // Update photo data
758
  wppa_rate_photo( $photo );
759
+
760
  // Get callback data
761
  $lt = wppa_get_like_title_a( $photo );
762
  $allavgratcombi = $lt['title'] . '|' . $lt['display'];
1123
  break;
1124
  case 'a_parent':
1125
  $itemname = __( 'Parent album' , 'wp-photo-album-plus');
1126
+ wppa_invalidate_treecounts( $album ); // Myself and my parents
1127
+ wppa_invalidate_treecounts( $value ); // My new parent
1128
  break;
1129
  case 'p_order_by':
1130
  $itemname = __( 'Photo order' , 'wp-photo-album-plus');
1505
  wppa_exit();
1506
  break;
1507
  }
1508
+ wppa_invalidate_treecounts( $photodata['album'] ); // Current album
1509
+ wppa_invalidate_treecounts( $value ); // New album
1510
  $iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `album` = %s WHERE `id` = %s', $value, $photo ) );
1511
  if ( $iret !== false ) {
1512
  wppa_move_source( $photodata['filename'], $photodata['album'], $value );
1534
  break;
1535
  }
1536
  wppa( 'error', wppa_copy_photo( $photo, $value ) );
1537
+ wppa_invalidate_treecounts( $value ); // New album
1538
  if ( ! wppa( 'error' ) ) {
1539
  echo '||0||'.sprintf( __( 'Photo %s copied to album %s (%s)' , 'wp-photo-album-plus'), $photo, wppa_get_album_name( $value ), $value );
1540
  }
1547
 
1548
  case 'status':
1549
  if ( ! current_user_can( 'wppa_moderate' ) && ! current_user_can( 'wppa_admin' ) ) die( 'Security check failure #78' );
1550
+ wppa_invalidate_treecounts( wppa_get_photo_item( $photo, 'album' ) ); // $wpdb->get_var( $wpdb->prepare( "SELECT `album` FROM `".WPPA_PHOTOS."` WHERE `id` = %s", $photo ) ) );
1551
  case 'owner':
1552
  case 'name':
1553
  case 'description':
1634
  $iret = $wpdb->query( $wpdb->prepare( 'UPDATE '.WPPA_PHOTOS.' SET `'.$item.'` = %s WHERE `id` = %s', $value, $photo ) );
1635
  if ( $item == 'name' || $item == 'description' || $item == 'tags' ) wppa_index_update( 'photo', $photo );
1636
  if ( $item == 'status' && $value != 'scheduled' ) wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => '' ) );
1637
+ if ( $item == 'status' ) wppa_invalidate_treecounts( wppa_get_photo_item( $photo, 'album' ) );
1638
  if ( $iret !== false ) {
1639
  wppa_update_modified( $photo );
1640
  if ( wppa_is_video( $photo ) ) {
1668
  if ( $item == 'min' ) $temp[4] = $value;
1669
  $scheduledtm = implode( ',', $temp );
1670
  wppa_update_photo( array( 'id' => $photo, 'scheduledtm' => $scheduledtm, 'status' => 'scheduled' ) );
1671
+ wppa_invalidate_treecounts( $wpdb->get_var( $wpdb->prepare( "SELECT `album` FROM `".WPPA_PHOTOS."` WHERE `id` = %s", $photo ) ) );
1672
  wppa_flush_upldr_cache( 'photoid', $photo );
1673
  if ( wppa_is_video( $photo ) ) {
1674
  echo '||0||'.sprintf( __( '%s of video %s updated' , 'wp-photo-album-plus'), $itemname, $photo );
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.6.00
7
  *
8
  */
9
 
@@ -126,7 +126,7 @@ function _wppa_admin() {
126
  else {
127
  $edit_id = $id;
128
  wppa_set_last_album($edit_id);
129
- wppa_flush_treecounts($edit_id);
130
  wppa_index_add('album', $id);
131
  wppa_update_message(__('Album #', 'wp-photo-album-plus') . ' ' . $edit_id . ' ' . __('Added.', 'wp-photo-album-plus'));
132
  wppa_create_pl_htaccess();
@@ -192,6 +192,11 @@ function _wppa_admin() {
192
  $default_tags = trim( $albuminfo['default_tags'], ',' );
193
  $cover_linktype = $albuminfo['cover_linktype'];
194
 
 
 
 
 
 
195
  // Open the photo album admin page
196
  echo
197
  '<div class="wrap">';
@@ -329,9 +334,15 @@ function wppaTryScheduleAll( id ) {
329
  // Views
330
  if ( wppa_switch( 'track_viewcounts' ) ) {
331
  echo
332
- __( 'Views:', 'wp-photo-album-plus' ) . ' ' . $views . '. ';
 
 
 
 
 
 
333
  }
334
-
335
  // Clicks
336
  if ( wppa_switch( 'track_clickcounts' ) ) {
337
  $click_arr = $wpdb->get_col( "SELECT `clicks` FROM `" . WPPA_PHOTOS . "` WHERE `album` = $id" );
@@ -339,6 +350,9 @@ function wppaTryScheduleAll( id ) {
339
  __( 'Clicks:', 'wp-photo-album-plus' ) . ' ' . array_sum( $click_arr ) . '. ';
340
  }
341
 
 
 
 
342
  // Owner
343
  echo
344
  __( 'Owned by:', 'wp-photo-album-plus' ) . ' ';
@@ -586,7 +600,7 @@ function wppaTryScheduleAll( id ) {
586
  }
587
 
588
  // Status
589
- echo
590
  __( 'Remark:', 'wp-photo-album-plus' ) . ' ' .
591
  '<span' .
592
  ' id="albumstatus-' . $id . '"' .
@@ -1407,8 +1421,8 @@ global $wpdb;
1407
  foreach (array_keys($seq) as $s) {
1408
  $album = $albums[$s];
1409
  if (wppa_have_access($album)) {
1410
- $counts = wppa_treecount_a($album['id']);
1411
- $pendcount = $counts['pendphotos'];
1412
  // $pendcount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `".WPPA_PHOTOS."` WHERE album=%s AND status=%s", $album['id'], 'pending'));
1413
  ?>
1414
  <tr <?php echo($alt); if ($pendcount) echo 'style="background-color:#ffdddd"' ?>>
@@ -1423,8 +1437,8 @@ global $wpdb;
1423
  <?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit_id='.$album['id']); ?>
1424
  <?php $na = $counts['selfalbums']; ?>
1425
  <?php $np = $counts['selfphotos']; ?>
1426
- <?php $nm = $counts['pendphotos']; ?>
1427
- <?php $ns = $counts['scheduledphotos']; ?>
1428
  <td><?php echo $na.'/'.$np.'/'.$nm.'/'.$ns; ?></td>
1429
  <?php if ( $album['owner'] != '--- public ---' || wppa_user_is('administrator') ) { ?>
1430
  <?php $url = wppa_ea_url($album['id']) ?>
@@ -2012,9 +2026,9 @@ global $wpdb;
2012
  $album = $albums[$s];
2013
  if ( $album['a_parent'] == $parent ) {
2014
  if (wppa_have_access($album)) {
2015
- $counts = wppa_treecount_a($album['id']);
2016
- $pendcount = $counts['pendphotos'];
2017
- $schedulecount = $counts['scheduledphotos'];
2018
  $haschildren = wppa_have_accessable_children($album);
2019
  {
2020
  $class = '';
@@ -2068,8 +2082,8 @@ global $wpdb;
2068
  <?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit_id='.$album['id']); ?>
2069
  <?php $na = $counts['selfalbums']; ?>
2070
  <?php $np = $counts['selfphotos']; ?>
2071
- <?php $nm = $counts['pendphotos']; ?>
2072
- <?php $ns = $counts['scheduledphotos']; ?>
2073
  <td><?php echo $na.'/'.$np.'/'.$nm.'/'.$ns; ?></td>
2074
  <?php if ( $album['owner'] != '--- public ---' || wppa_user_is('administrator') ) { ?>
2075
  <?php $url = wppa_ea_url($album['id']) ?>
@@ -2141,7 +2155,7 @@ global $wpdb;
2141
  // wppa_dbg_msg('Del photo took :'.$t, 'red', 'force');
2142
  // Time up?
2143
  if ( wppa_is_time_up() ) {
2144
- wppa_flush_treecounts( $id );
2145
  $msg = sprintf( __( 'Time is out after %d photo deletes. Please redo this operation' , 'wp-photo-album-plus'), $cnt );
2146
  if ( wppa( 'ajax' ) ) {
2147
  echo $msg;
@@ -2166,11 +2180,11 @@ global $wpdb;
2166
  }
2167
  }
2168
  }
2169
- wppa_flush_treecounts($move);
2170
  }
2171
 
2172
  // First flush treecounts, otherwise we do not know the parent if any
2173
- wppa_flush_treecounts($id);
2174
 
2175
  // Now delete the album
2176
  $wpdb->query($wpdb->prepare('DELETE FROM `' . WPPA_ALBUMS . '` WHERE `id` = %s LIMIT 1', $id));
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 6.6.09
7
  *
8
  */
9
 
126
  else {
127
  $edit_id = $id;
128
  wppa_set_last_album($edit_id);
129
+ wppa_invalidate_treecounts($edit_id);
130
  wppa_index_add('album', $id);
131
  wppa_update_message(__('Album #', 'wp-photo-album-plus') . ' ' . $edit_id . ' ' . __('Added.', 'wp-photo-album-plus'));
132
  wppa_create_pl_htaccess();
192
  $default_tags = trim( $albuminfo['default_tags'], ',' );
193
  $cover_linktype = $albuminfo['cover_linktype'];
194
 
195
+ $treecounts = wppa_get_treecounts_a( $id, true );
196
+ $pviews = $treecounts['selfphotoviews'];
197
+ $tpviews = $treecounts['treephotoviews'];
198
+ $nsub = $treecounts['selfalbums'];
199
+
200
  // Open the photo album admin page
201
  echo
202
  '<div class="wrap">';
334
  // Views
335
  if ( wppa_switch( 'track_viewcounts' ) ) {
336
  echo
337
+ __( 'Album Views:', 'wp-photo-album-plus' ) . ' ' . $views . ', ';
338
+ echo
339
+ __( 'Photo views:', 'wp-photo-album-plus' ) . ' ' . $pviews . '. ';
340
+ if ( $nsub ) {
341
+ echo
342
+ __( 'Photo views inc sub albums:', 'wp-photo-album-plus' ) . ' ' . $tpviews . '. ';
343
+ }
344
  }
345
+
346
  // Clicks
347
  if ( wppa_switch( 'track_clickcounts' ) ) {
348
  $click_arr = $wpdb->get_col( "SELECT `clicks` FROM `" . WPPA_PHOTOS . "` WHERE `album` = $id" );
350
  __( 'Clicks:', 'wp-photo-album-plus' ) . ' ' . array_sum( $click_arr ) . '. ';
351
  }
352
 
353
+ // Newline
354
+ echo '<br />';
355
+
356
  // Owner
357
  echo
358
  __( 'Owned by:', 'wp-photo-album-plus' ) . ' ';
600
  }
601
 
602
  // Status
603
+ echo '<br />' .
604
  __( 'Remark:', 'wp-photo-album-plus' ) . ' ' .
605
  '<span' .
606
  ' id="albumstatus-' . $id . '"' .
1421
  foreach (array_keys($seq) as $s) {
1422
  $album = $albums[$s];
1423
  if (wppa_have_access($album)) {
1424
+ $counts = wppa_get_treecounts_a($album['id'], true);
1425
+ $pendcount = $counts['pendselfphotos'];
1426
  // $pendcount = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM `".WPPA_PHOTOS."` WHERE album=%s AND status=%s", $album['id'], 'pending'));
1427
  ?>
1428
  <tr <?php echo($alt); if ($pendcount) echo 'style="background-color:#ffdddd"' ?>>
1437
  <?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit_id='.$album['id']); ?>
1438
  <?php $na = $counts['selfalbums']; ?>
1439
  <?php $np = $counts['selfphotos']; ?>
1440
+ <?php $nm = $counts['pendselfphotos']; ?>
1441
+ <?php $ns = $counts['scheduledselfphotos']; ?>
1442
  <td><?php echo $na.'/'.$np.'/'.$nm.'/'.$ns; ?></td>
1443
  <?php if ( $album['owner'] != '--- public ---' || wppa_user_is('administrator') ) { ?>
1444
  <?php $url = wppa_ea_url($album['id']) ?>
2026
  $album = $albums[$s];
2027
  if ( $album['a_parent'] == $parent ) {
2028
  if (wppa_have_access($album)) {
2029
+ $counts = wppa_get_treecounts_a($album['id'], true);
2030
+ $pendcount = $counts['pendselfphotos'];
2031
+ $schedulecount = $counts['scheduledselfphotos'];
2032
  $haschildren = wppa_have_accessable_children($album);
2033
  {
2034
  $class = '';
2082
  <?php $url = wppa_dbg_url(get_admin_url().'admin.php?page=wppa_admin_menu&amp;tab=edit&amp;edit_id='.$album['id']); ?>
2083
  <?php $na = $counts['selfalbums']; ?>
2084
  <?php $np = $counts['selfphotos']; ?>
2085
+ <?php $nm = $counts['pendselfphotos']; ?>
2086
+ <?php $ns = $counts['scheduledselfphotos']; ?>
2087
  <td><?php echo $na.'/'.$np.'/'.$nm.'/'.$ns; ?></td>
2088
  <?php if ( $album['owner'] != '--- public ---' || wppa_user_is('administrator') ) { ?>
2089
  <?php $url = wppa_ea_url($album['id']) ?>
2155
  // wppa_dbg_msg('Del photo took :'.$t, 'red', 'force');
2156
  // Time up?
2157
  if ( wppa_is_time_up() ) {
2158
+ wppa_invalidate_treecounts( $id );
2159
  $msg = sprintf( __( 'Time is out after %d photo deletes. Please redo this operation' , 'wp-photo-album-plus'), $cnt );
2160
  if ( wppa( 'ajax' ) ) {
2161
  echo $msg;
2180
  }
2181
  }
2182
  }
2183
+ wppa_invalidate_treecounts($move);
2184
  }
2185
 
2186
  // First flush treecounts, otherwise we do not know the parent if any
2187
+ wppa_invalidate_treecounts($id);
2188
 
2189
  // Now delete the album
2190
  $wpdb->query($wpdb->prepare('DELETE FROM `' . WPPA_ALBUMS . '` WHERE `id` = %s LIMIT 1', $id));
wppa-album-covers.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
- * Version 6.6.07
7
  *
8
  */
9
 
@@ -280,7 +280,7 @@ global $wpdb;
280
  else {
281
  $txtheight = '';
282
  }
283
- wppa_out( '<p' .
284
  ' class="wppa-box-text wppa-black wppa-box-text-desc"' .
285
  ' style="' .
286
  $textheight .
@@ -289,7 +289,7 @@ global $wpdb;
289
  '"' .
290
  ' >' .
291
  wppa_get_album_desc( $albumid ) .
292
- '</p>'
293
  );
294
  }
295
 
@@ -540,7 +540,7 @@ global $wpdb;
540
  $textheight = wppa_opt( 'text_frame_height' ) > '0' ?
541
  'min-height:' . wppa_opt( 'text_frame_height' ) . 'px; ' :
542
  '';
543
- wppa_out( '<p' .
544
  ' class="wppa-box-text wppa-black wppa-box-text-desc"' .
545
  ' style="' .
546
  $textheight .
@@ -549,7 +549,7 @@ global $wpdb;
549
  '"' .
550
  ' >' .
551
  wppa_get_album_desc( $albumid ) .
552
- '</p>'
553
  );
554
  }
555
 
@@ -776,7 +776,7 @@ global $wpdb;
776
  ' id="coverdesc_frame_' . $albumid . '_' . wppa( 'mocc' ) . '"' .
777
  ' style="clear:both"' .
778
  ' >' .
779
- '<p' .
780
  ' class="wppa-box-text wppa-black wppa-box-text-desc"' .
781
  ' style="' .
782
  $textheight .
@@ -785,7 +785,7 @@ global $wpdb;
785
  '"' .
786
  ' >' .
787
  wppa_get_album_desc( $albumid ) .
788
- '</p>' .
789
  '</div>'
790
  );
791
  }
@@ -981,6 +981,26 @@ global $wpdb;
981
  }
982
  }
983
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
984
  // Close the coverphoto frame
985
  wppa_out( '</div>' );
986
  }
@@ -1399,7 +1419,7 @@ function wppa_album_cover_view_link(
1399
 
1400
  // Get treecount data
1401
  if ( wppa_opt( 'show_treecount' ) != '-none-' ) {
1402
- $treecount = wppa_treecount_a( $albumid );
1403
  }
1404
  else {
1405
  $treecount = false;
@@ -1422,10 +1442,10 @@ function wppa_album_cover_view_link(
1422
  }
1423
 
1424
  $na = $albumcount;
1425
- $nta = $treecount['albums'] > $albumcount ? $treecount['albums'] : '';
1426
  $np = $photocount > $mincount ? $photocount : '';
1427
- $ntp = $treecount['photos'] > $photocount ? $treecount['photos'] : '';
1428
- $ntpx = $treecount['photos'] > $photocount ? $treecount['photos'] : $photocount;
1429
 
1430
  $text = __( 'View' , 'wp-photo-album-plus') . ' ';
1431
 
@@ -1501,10 +1521,10 @@ function wppa_the_album_title( $alb, $href_title, $onclick_title, $title, $targe
1501
  $cnt = wppa_get_photo_count( $alb );
1502
  }
1503
  if ( wppa_opt( 'count_on_title' ) == 'total' ) {
1504
- $temp = wppa_treecount_a( $alb );
1505
- $cnt = $temp['photos'];
1506
  if ( current_user_can( 'wppa_moderate' ) ) {
1507
- $cnt += $temp['pendphotos'];
1508
  }
1509
  }
1510
  if ( $cnt ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Functions for album covers
6
+ * Version 6.6.09
7
  *
8
  */
9
 
280
  else {
281
  $txtheight = '';
282
  }
283
+ wppa_out( '<div' .
284
  ' class="wppa-box-text wppa-black wppa-box-text-desc"' .
285
  ' style="' .
286
  $textheight .
289
  '"' .
290
  ' >' .
291
  wppa_get_album_desc( $albumid ) .
292
+ '</div>'
293
  );
294
  }
295
 
540
  $textheight = wppa_opt( 'text_frame_height' ) > '0' ?
541
  'min-height:' . wppa_opt( 'text_frame_height' ) . 'px; ' :
542
  '';
543
+ wppa_out( '<div' .
544
  ' class="wppa-box-text wppa-black wppa-box-text-desc"' .
545
  ' style="' .
546
  $textheight .
549
  '"' .
550
  ' >' .
551
  wppa_get_album_desc( $albumid ) .
552
+ '</div>'
553
  );
554
  }
555
 
776
  ' id="coverdesc_frame_' . $albumid . '_' . wppa( 'mocc' ) . '"' .
777
  ' style="clear:both"' .
778
  ' >' .
779
+ '<div' .
780
  ' class="wppa-box-text wppa-black wppa-box-text-desc"' .
781
  ' style="' .
782
  $textheight .
785
  '"' .
786
  ' >' .
787
  wppa_get_album_desc( $albumid ) .
788
+ '</div>' .
789
  '</div>'
790
  );
791
  }
981
  }
982
  }
983
 
984
+ // Viewcount on coverphoto?
985
+ if ( wppa_opt( 'viewcount_on_cover' ) != '-none-' ) {
986
+ $treecounts = wppa_get_treecounts_a( $albumid );
987
+ if ( wppa_opt( 'viewcount_on_cover' ) == 'self' || $treecounts['selfphotoviews'] == $treecounts['treephotoviews'] ) {
988
+ $count = $treecounts['selfphotoviews'];
989
+ $title = __( 'Number of photo views in this album', 'wp-photo-album-plus' );
990
+ }
991
+ else {
992
+ $count = $treecounts['treephotoviews'];
993
+ $title = __( 'Number of photo views in this album and its sub-albums', 'wp-photo-album-plus' );
994
+ }
995
+ wppa_out( '<div' .
996
+ ' class="wppa-album-cover-viewcount"' .
997
+ ' title="' . esc_attr( $title ) . '"' .
998
+ ' style="cursor:pointer;"' .
999
+ ' >' .
1000
+ __( 'Views:', 'wp-photo-album-plus' ) . ' ' . $count .
1001
+ '</div>' );
1002
+ }
1003
+
1004
  // Close the coverphoto frame
1005
  wppa_out( '</div>' );
1006
  }
1419
 
1420
  // Get treecount data
1421
  if ( wppa_opt( 'show_treecount' ) != '-none-' ) {
1422
+ $treecount = wppa_get_treecounts_a( $albumid );
1423
  }
1424
  else {
1425
  $treecount = false;
1442
  }
1443
 
1444
  $na = $albumcount;
1445
+ $nta = $treecount['treealbums'] > $albumcount ? $treecount['treealbums'] : '';
1446
  $np = $photocount > $mincount ? $photocount : '';
1447
+ $ntp = $treecount['treephotos'] > $photocount ? $treecount['treephotos'] : '';
1448
+ $ntpx = $treecount['treephotos'] > $photocount ? $treecount['treephotos'] : $photocount;
1449
 
1450
  $text = __( 'View' , 'wp-photo-album-plus') . ' ';
1451
 
1521
  $cnt = wppa_get_photo_count( $alb );
1522
  }
1523
  if ( wppa_opt( 'count_on_title' ) == 'total' ) {
1524
+ $temp = wppa_get_treecounts_a( $alb );
1525
+ $cnt = $temp['treephotos'];
1526
  if ( current_user_can( 'wppa_moderate' ) ) {
1527
+ $cnt += $temp['pendtreephotos'];
1528
  }
1529
  }
1530
  if ( $cnt ) {
wppa-album-navigator-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display album names linking to content
6
- * Version 6.4.17
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
@@ -160,8 +160,8 @@ class AlbumNavigatorWidget extends WP_Widget {
160
  $result .= '<ul>';
161
  foreach ( $albums as $album ) {
162
  $a = $album['id'];
163
- $treecount = wppa_treecount_a( $a );
164
- if ( $treecount['albums'] || $treecount['photos'] > wppa_opt( 'min_thumbs' ) || $skip == 'no' ) {
165
  $result .= '
166
  <li class="anw-'.$w.'-'.$p.$propclass.'" style="list-style:none; display:'.( $level == '1' ? '' : 'none' ).';">';
167
  if ( wppa_has_children($a) ) $result .= '
3
  * Package: wp-photo-album-plus
4
  *
5
  * display album names linking to content
6
+ * Version 6.6.09
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
160
  $result .= '<ul>';
161
  foreach ( $albums as $album ) {
162
  $a = $album['id'];
163
+ $treecount = wppa_get_treecounts_a( $a );
164
+ if ( $treecount['treealbums'] || $treecount['selfphotos'] > wppa_opt( 'min_thumbs' ) || $skip == 'no' ) {
165
  $result .= '
166
  <li class="anw-'.$w.'-'.$p.$propclass.'" style="list-style:none; display:'.( $level == '1' ? '' : 'none' ).';">';
167
  if ( wppa_has_children($a) ) $result .= '
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 6.6.08
7
  *
8
  */
9
 
@@ -296,8 +296,8 @@ global $wppa_session;
296
  if ( is_array( $albums ) ) foreach ( array_keys( $albums ) as $albumkey ) {
297
  $albumid = $albums[$albumkey]['id'];
298
  $albumowner = $albums[$albumkey]['owner'];
299
- $treecount = wppa_treecount_a( $albums[$albumkey]['id'] );
300
- $photocount = $treecount['photos'];
301
  if ( ! $photocount && ! wppa_user_is( 'administrator' ) && $user != $albumowner ) {
302
  unset( $albums[$albumkey] );
303
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 6.6.09
7
  *
8
  */
9
 
296
  if ( is_array( $albums ) ) foreach ( array_keys( $albums ) as $albumkey ) {
297
  $albumid = $albums[$albumkey]['id'];
298
  $albumowner = $albums[$albumkey]['owner'];
299
+ $treecount = wppa_get_treecounts_a( $albums[$albumkey]['id'] );
300
+ $photocount = $treecount['treephotos'];
301
  if ( ! $photocount && ! wppa_user_is( 'administrator' ) && $user != $albumowner ) {
302
  unset( $albums[$albumkey] );
303
  }
wppa-common-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
- * Version 6.6.08
6
  *
7
  */
8
 
@@ -1836,12 +1836,12 @@ global $wpdb;
1836
  if ( $to_publish ) foreach ( $to_publish as $photo ) {
1837
  wppa_update_photo( array( 'id' => $photo['id'], 'scheduledtm' => '', 'status' => 'publish', 'timestamp' => time() ) );
1838
  wppa_update_album( array( 'id' => $photo['album'], 'modified' => time() ) ); // For New indicator on album
1839
- wppa_flush_treecounts( $photo['album'] );
1840
  }
1841
  $to_publish = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM`".WPPA_ALBUMS."` WHERE `scheduledtm` <> '' AND `scheduledtm` < %s", wppa_get_default_scheduledtm() ), ARRAY_A );
1842
  if ( $to_publish ) foreach ( $to_publish as $album ) {
1843
  wppa_update_album( array( 'id' => $album['id'], 'scheduledtm' => '' ) );
1844
- wppa_flush_treecounts( $album['id'] );
1845
  }
1846
  update_option( 'wppa_last_schedule_check', time() );
1847
  }
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 6.6.09
6
  *
7
  */
8
 
1836
  if ( $to_publish ) foreach ( $to_publish as $photo ) {
1837
  wppa_update_photo( array( 'id' => $photo['id'], 'scheduledtm' => '', 'status' => 'publish', 'timestamp' => time() ) );
1838
  wppa_update_album( array( 'id' => $photo['album'], 'modified' => time() ) ); // For New indicator on album
1839
+ wppa_invalidate_treecounts( $photo['album'] );
1840
  }
1841
  $to_publish = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM`".WPPA_ALBUMS."` WHERE `scheduledtm` <> '' AND `scheduledtm` < %s", wppa_get_default_scheduledtm() ), ARRAY_A );
1842
  if ( $to_publish ) foreach ( $to_publish as $album ) {
1843
  wppa_update_album( array( 'id' => $album['id'], 'scheduledtm' => '' ) );
1844
+ wppa_invalidate_treecounts( $album['id'] );
1845
  }
1846
  update_option( 'wppa_last_schedule_check', time() );
1847
  }
wppa-cron.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
- * Version 6.6.00
7
  *
8
  *
9
  */
@@ -60,3 +60,34 @@ global $wpdb;
60
  wppa_create_pl_htaccess();
61
 
62
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
+ * Version 6.6.09
7
  *
8
  *
9
  */
60
  wppa_create_pl_htaccess();
61
 
62
  }
63
+
64
+ // Activate treecount update proc
65
+ add_action( 'wppa_update_treecounts', 'wppa_do_update_treecounts' );
66
+
67
+ function wppa_schedule_treecount_update() {
68
+
69
+ // Schedule cron job
70
+ if ( ! wp_next_scheduled( 'wppa_update_treecounts' ) ) {
71
+ wp_schedule_single_event( time() + 30, 'wppa_update_treecounts' );
72
+ }
73
+ }
74
+
75
+ function wppa_do_update_treecounts() {
76
+ global $wpdb;
77
+
78
+ $start = time();
79
+
80
+ $albs = $wpdb->get_col( "SELECT `id` FROM `" . WPPA_ALBUMS . "` WHERE `a_parent` < '1' ORDER BY `id`" );
81
+
82
+ foreach( $albs as $alb ) {
83
+ $treecounts = wppa_get_treecounts_a( $alb );
84
+ if ( $treecounts['needupdate'] ) {
85
+ wppa_verify_treecounts_a( $alb );
86
+ // wppa_log( 'Dbg', 'Cron fixed treecounts for ' . $alb );
87
+ }
88
+ if ( time() > $start + 30 ) {
89
+ wppa_schedule_treecount_update();
90
+ exit();
91
+ }
92
+ }
93
+ }
wppa-encrypt.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all ecryption/decryption logic
6
- * Version 6.6.08
7
  *
8
  */
9
 
@@ -136,7 +136,7 @@ global $wpdb;
136
  // Already decrypted?
137
  if ( strlen( $photo ) < 12 ) {
138
  if ( wppa_switch( 'refuse_unencrypted' ) ) {
139
- wppa_dbg_msg( __( 'Invalid photo identifier:', 'wp-photo-album-plus') . ' ' . $photo, 'red', 'force' );
140
  return false;
141
  }
142
  return $photo;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all ecryption/decryption logic
6
+ * Version 6.6.09
7
  *
8
  */
9
 
136
  // Already decrypted?
137
  if ( strlen( $photo ) < 12 ) {
138
  if ( wppa_switch( 'refuse_unencrypted' ) ) {
139
+ wppa_dbg_msg( __( 'Invalid photo identifier:', 'wp-photo-album-plus' ) . ' ' . $photo, 'red', 'force' );
140
  return false;
141
  }
142
  return $photo;
wppa-filter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
- * Version 6.6.00
7
  *
8
  */
9
 
@@ -55,10 +55,11 @@ global $wppa_revno;
55
  'landing' => '',
56
  'admin' => '',
57
  'parent' => '',
58
- 'pcount' => '',
59
- 'acount' => '',
60
  ), $xatts );
61
 
 
 
 
62
  // Find occur
63
  if ( get_the_ID() != $wppa_postid ) { // New post
64
  $wppa['occur'] = '0'; // Init this occurance
@@ -66,33 +67,8 @@ global $wppa_revno;
66
  $wppa_postid = get_the_ID(); // Remember the post id
67
  }
68
 
69
- // Set internal defaults
70
- $wppa['start_album'] = '';
71
- $wppa['is_cover'] = '0';
72
- $wppa['is_slide'] = '0';
73
- $wppa['is_slideonly'] = '0';
74
- $wppa['is_filmonly'] = '0';
75
- $wppa['single_photo'] = '';
76
- $wppa['is_mphoto'] = '0';
77
- $wppa['film_on'] = '0';
78
- $wppa['is_landing'] = '0';
79
- $wppa['start_photo'] = '0'; // Start a slideshow here
80
- $wppa['is_single'] = false; // Is a one image slideshow
81
- $wppa['is_upload'] = false;
82
- $wppa['is_multitagbox'] = false;
83
- $wppa['is_tagcloudbox'] = false;
84
- $wppa['taglist'] = '';
85
- $wppa['tagcols'] = '2';
86
- $wppa['is_autopage'] = false;
87
- $wppa['portrait_only'] = false;
88
  $wppa['shortcode_content'] = $content;
89
- $wppa['is_url'] = false;
90
- $wppa['forceroot'] = '';
91
- $wppa['landingpage'] = '';
92
- $wppa['is_admins_choice'] = false;
93
- $wppa['admins_choice_users'] = '';
94
- $wppa['albums_only'] = false;
95
- $wppa['max_width'] = false;
96
 
97
  // Find type
98
  switch ( $atts['type'] ) {
@@ -247,7 +223,7 @@ global $wppa_revno;
247
  $t = $atts['type'];
248
  if ( $a xor $p ) {
249
  $alb = $a ? $a : $p;
250
- $tc = wppa_treecount_a( $alb );
251
 
252
  // Album based count requested
253
  if ( $a ) {
@@ -262,10 +238,10 @@ global $wppa_revno;
262
  // Parent based count requested
263
  else {
264
  if ( $t == 'acount' ) {
265
- return $tc['albums'];
266
  }
267
  else {
268
- return $tc['photos'];
269
  }
270
 
271
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 6.6.09
7
  *
8
  */
9
 
55
  'landing' => '',
56
  'admin' => '',
57
  'parent' => '',
 
 
58
  ), $xatts );
59
 
60
+ // Init
61
+ wppa_reset_occurrance();
62
+
63
  // Find occur
64
  if ( get_the_ID() != $wppa_postid ) { // New post
65
  $wppa['occur'] = '0'; // Init this occurance
67
  $wppa_postid = get_the_ID(); // Remember the post id
68
  }
69
 
70
+ // Whatever is entered between [wppa ...] and [/wppa]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
71
  $wppa['shortcode_content'] = $content;
 
 
 
 
 
 
 
72
 
73
  // Find type
74
  switch ( $atts['type'] ) {
223
  $t = $atts['type'];
224
  if ( $a xor $p ) {
225
  $alb = $a ? $a : $p;
226
+ $tc = wppa_get_treecounts_a( $alb );
227
 
228
  // Album based count requested
229
  if ( $a ) {
238
  // Parent based count requested
239
  else {
240
  if ( $t == 'acount' ) {
241
+ return $tc['selfalbums'];
242
  }
243
  else {
244
+ return $tc['selfphotos'];
245
  }
246
 
247
  }
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 6.6.07
7
  *
8
  */
9
 
@@ -379,7 +379,6 @@ global $wppa_session;
379
  wppa( 'is_related', $type );
380
 
381
  $data = wppa_get_related_data();
382
-
383
  if ( $type == 'tags' ) {
384
  wppa( 'is_tag', $data );
385
  }
@@ -1096,9 +1095,6 @@ global $wppa_session;
1096
  $q = $wpdb->prepare( 'SELECT * FROM ' . WPPA_ALBUMS . ' WHERE `a_parent` = %s '. wppa_get_album_order( $id ), $id );
1097
  }
1098
  $albums = $wpdb->get_results( $q, ARRAY_A );
1099
- if ( ! wppa( 'is_cover' ) ) {
1100
- wppa_verify_treecounts( $id, 'albums', count( $albums ) );
1101
- }
1102
  }
1103
  elseif ( strpos( $id, '.' ) !== false ) { // Album enum
1104
  $ids = wppa_series_to_array( $id );
@@ -1120,8 +1116,8 @@ global $wppa_session;
1120
  if ( is_array( $albums ) ) foreach ( array_keys( $albums ) as $albumkey ) {
1121
  $albumid = $albums[$albumkey]['id'];
1122
  $albumowner = $albums[$albumkey]['owner'];
1123
- $treecount = wppa_treecount_a( $albums[$albumkey]['id'] );
1124
- $photocount = $treecount['photos'];
1125
  if ( ! $photocount && ! wppa_user_is( 'administrator' ) && $user != $albumowner ) unset( $albums[$albumkey] );
1126
  }
1127
  }
@@ -1662,6 +1658,9 @@ global $wppa_session;
1662
  // remove dups from $final_array
1663
  $final_array = array_unique( $final_array );
1664
 
 
 
 
1665
  // Make album clause
1666
  $alb_clause = '';
1667
 
@@ -1703,8 +1702,16 @@ global $wppa_session;
1703
  $selection = " `id` = '0' ";
1704
  }
1705
 
 
 
 
 
 
 
 
 
1706
  // Construct the query
1707
- $query = "SELECT * FROM `" . WPPA_PHOTOS . "` WHERE " . $selection . $alb_clause . wppa_get_photo_order( '0' );
1708
  }
1709
 
1710
  // Calendar?
@@ -2583,6 +2590,15 @@ global $wpdb;
2583
 
2584
  $desc = wppa_switch( 'popup_text_desc' ) ? wppa_get_photo_desc( $id ) : '';
2585
  if ( wppa_switch( 'popup_text_desc_strip' ) ) $desc = wppa_strip_tags( $desc );
 
 
 
 
 
 
 
 
 
2586
  $desc = esc_js( $desc );
2587
 
2588
  $rating = wppa_switch( 'popup_text_rating' ) ? wppa_get_rating_by_id( $id ) : '';
@@ -4107,7 +4123,7 @@ static $done;
4107
  if ( wppa_switch( 'fe_alert' ) ) {
4108
  wppa_alert( sprintf( __( 'Album #%s created' , 'wp-photo-album-plus'), $album ) );
4109
  }
4110
- wppa_flush_treecounts( $parent );
4111
  wppa_create_pl_htaccess();
4112
  }
4113
  else {
@@ -4373,7 +4389,7 @@ global $wppa_supported_audio_extensions;
4373
 
4374
  // Housekeeping
4375
  wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
4376
- wppa_flush_treecounts( $alb );
4377
  wppa_flush_upldr_cache( 'photoid', $id );
4378
 
4379
  // Add video filetype
@@ -4488,7 +4504,7 @@ global $wppa_supported_audio_extensions;
4488
  wppa_save_source( $file['tmp_name'], $filename, $alb );
4489
  wppa_make_o1_source( $id );
4490
  wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
4491
- wppa_flush_treecounts( $alb );
4492
  wppa_flush_upldr_cache( 'photoid', $id );
4493
  }
4494
  if ( wppa_make_the_photo_files( $file['tmp_name'], $id, $ext ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 6.6.09
7
  *
8
  */
9
 
379
  wppa( 'is_related', $type );
380
 
381
  $data = wppa_get_related_data();
 
382
  if ( $type == 'tags' ) {
383
  wppa( 'is_tag', $data );
384
  }
1095
  $q = $wpdb->prepare( 'SELECT * FROM ' . WPPA_ALBUMS . ' WHERE `a_parent` = %s '. wppa_get_album_order( $id ), $id );
1096
  }
1097
  $albums = $wpdb->get_results( $q, ARRAY_A );
 
 
 
1098
  }
1099
  elseif ( strpos( $id, '.' ) !== false ) { // Album enum
1100
  $ids = wppa_series_to_array( $id );
1116
  if ( is_array( $albums ) ) foreach ( array_keys( $albums ) as $albumkey ) {
1117
  $albumid = $albums[$albumkey]['id'];
1118
  $albumowner = $albums[$albumkey]['owner'];
1119
+ $treecount = wppa_get_treecounts_a( $albums[$albumkey]['id'] );
1120
+ $photocount = $treecount['treephotos'];
1121
  if ( ! $photocount && ! wppa_user_is( 'administrator' ) && $user != $albumowner ) unset( $albums[$albumkey] );
1122
  }
1123
  }
1658
  // remove dups from $final_array
1659
  $final_array = array_unique( $final_array );
1660
 
1661
+ // Remove empty element from array
1662
+ $final_array = array_diff( $final_array, array( '' ) );
1663
+
1664
  // Make album clause
1665
  $alb_clause = '';
1666
 
1702
  $selection = " `id` = '0' ";
1703
  }
1704
 
1705
+ // If Related, add related count max
1706
+ $limit = '';
1707
+ if ( wppa( 'is_related' ) ) {
1708
+ if ( wppa( 'related_count' ) ) {
1709
+ $limit = " LIMIT " . strval( intval( wppa( 'related_count' ) ) );
1710
+ }
1711
+ }
1712
+
1713
  // Construct the query
1714
+ $query = "SELECT * FROM `" . WPPA_PHOTOS . "` WHERE " . $selection . $alb_clause . wppa_get_photo_order( '0' ) . $limit;
1715
  }
1716
 
1717
  // Calendar?
2590
 
2591
  $desc = wppa_switch( 'popup_text_desc' ) ? wppa_get_photo_desc( $id ) : '';
2592
  if ( wppa_switch( 'popup_text_desc_strip' ) ) $desc = wppa_strip_tags( $desc );
2593
+
2594
+ // Run wpautop on description?
2595
+ if ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'wpautop' ) {
2596
+ $desc = wpautop( $desc );
2597
+ }
2598
+ elseif ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'nl2br' ) {
2599
+ $desc = nl2br( $desc );
2600
+ }
2601
+
2602
  $desc = esc_js( $desc );
2603
 
2604
  $rating = wppa_switch( 'popup_text_rating' ) ? wppa_get_rating_by_id( $id ) : '';
4123
  if ( wppa_switch( 'fe_alert' ) ) {
4124
  wppa_alert( sprintf( __( 'Album #%s created' , 'wp-photo-album-plus'), $album ) );
4125
  }
4126
+ wppa_invalidate_treecounts( $parent );
4127
  wppa_create_pl_htaccess();
4128
  }
4129
  else {
4389
 
4390
  // Housekeeping
4391
  wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
4392
+ wppa_invalidate_treecounts( $alb );
4393
  wppa_flush_upldr_cache( 'photoid', $id );
4394
 
4395
  // Add video filetype
4504
  wppa_save_source( $file['tmp_name'], $filename, $alb );
4505
  wppa_make_o1_source( $id );
4506
  wppa_update_album( array( 'id' => $alb, 'modified' => time() ) );
4507
+ wppa_invalidate_treecounts( $alb );
4508
  wppa_flush_upldr_cache( 'photoid', $id );
4509
  }
4510
  if ( wppa_make_the_photo_files( $file['tmp_name'], $id, $ext ) ) {
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.6.08
7
  *
8
  */
9
 
@@ -1661,7 +1661,7 @@ global $wppa_supported_audio_extensions;
1661
  if ( $dela ) unlink( $album );
1662
  $acount++;
1663
  wppa_clear_cache();
1664
- wppa_flush_treecounts( $id );
1665
  } // album added
1666
  } // album did not exist
1667
  } // if handle ( file open )
@@ -1928,7 +1928,7 @@ global $wppa_supported_audio_extensions;
1928
  // Add new entry
1929
  if ( ! $id ) {
1930
  $id = wppa_create_photo_entry( array( 'album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => wppa_strip_ext( $filename ) ) );
1931
- wppa_flush_treecounts( $alb );
1932
  }
1933
 
1934
  // Add video filetype
@@ -2000,7 +2000,7 @@ global $wppa_supported_audio_extensions;
2000
  // Add new entry
2001
  if ( ! $id ) {
2002
  $id = wppa_create_photo_entry( array( 'album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => wppa_strip_ext( $filename ) ) );
2003
- wppa_flush_treecounts( $alb );
2004
  }
2005
 
2006
  // Add audio filetype
@@ -2615,7 +2615,7 @@ global $wppa_session;
2615
  }
2616
  else {
2617
  wppa_set_last_album( $alb );
2618
- wppa_flush_treecounts( $alb );
2619
  wppa_index_add( 'album', $alb );
2620
  wppa_create_pl_htaccess();
2621
  wppa_ok_message( __( 'Album #', 'wp-photo-album-plus') . ' ' . $alb . ' ( '.$name.' ) ' . __( 'Added.', 'wp-photo-album-plus') );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 6.6.09
7
  *
8
  */
9
 
1661
  if ( $dela ) unlink( $album );
1662
  $acount++;
1663
  wppa_clear_cache();
1664
+ wppa_invalidate_treecounts( $id );
1665
  } // album added
1666
  } // album did not exist
1667
  } // if handle ( file open )
1928
  // Add new entry
1929
  if ( ! $id ) {
1930
  $id = wppa_create_photo_entry( array( 'album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => wppa_strip_ext( $filename ) ) );
1931
+ wppa_invalidate_treecounts( $alb );
1932
  }
1933
 
1934
  // Add video filetype
2000
  // Add new entry
2001
  if ( ! $id ) {
2002
  $id = wppa_create_photo_entry( array( 'album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => wppa_strip_ext( $filename ) ) );
2003
+ wppa_invalidate_treecounts( $alb );
2004
  }
2005
 
2006
  // Add audio filetype
2615
  }
2616
  else {
2617
  wppa_set_last_album( $alb );
2618
+ wppa_invalidate_treecounts( $alb );
2619
  wppa_index_add( 'album', $alb );
2620
  wppa_create_pl_htaccess();
2621
  wppa_ok_message( __( 'Album #', 'wp-photo-album-plus') . ' ' . $alb . ' ( '.$name.' ) ' . __( 'Added.', 'wp-photo-album-plus') );
wppa-items.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
- * Version 6.6.07
7
  *
8
  */
9
 
@@ -16,6 +16,10 @@ global $wpdb;
16
  static $album;
17
  static $album_cache_2;
18
 
 
 
 
 
19
  // Init. If there are less than 1000 albums, cache them all on beforehand.
20
  // This reduces the number of queries for albums to two.
21
  // Only for front-end
@@ -105,7 +109,7 @@ static $album_cache_2;
105
  }
106
  else {
107
  wppa_dbg_msg( 'Album '.$id.' does not exist (cache album)', 'red' );
108
- wppa_log( 'dbg', 'Album '.$id.' does not exist (cache album)', true );
109
  return false;
110
  }
111
  }
@@ -607,7 +611,7 @@ function wppa_get_album_item( $id, $item ) {
607
  }
608
  }
609
  else {
610
- wppa_log( 'Dbg', 'Album ' . $id . ' does not exist. ( get_album_item )' );
611
  }
612
  return false;
613
  }
@@ -626,7 +630,7 @@ function wppa_get_photo_item( $id, $item ) {
626
  }
627
  }
628
  else {
629
- wppa_log( 'Dbg', 'Photo ' . $id . ' does not exist. ( get_photo_item )' );
630
  }
631
  return false;
632
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
+ * Version 6.6.09
7
  *
8
  */
9
 
16
  static $album;
17
  static $album_cache_2;
18
 
19
+ if ( $id == '-9' ) {
20
+ return false;
21
+ }
22
+
23
  // Init. If there are less than 1000 albums, cache them all on beforehand.
24
  // This reduces the number of queries for albums to two.
25
  // Only for front-end
109
  }
110
  else {
111
  wppa_dbg_msg( 'Album '.$id.' does not exist (cache album)', 'red' );
112
+ wppa_log( 'dbg', 'Album '.$id.' does not exist (cache album)' );
113
  return false;
114
  }
115
  }
611
  }
612
  }
613
  else {
614
+ // wppa_log( 'Dbg', 'Album ' . $id . ' does not exist. ( get_album_item )' );
615
  }
616
  return false;
617
  }
630
  }
631
  }
632
  else {
633
+ // wppa_log( 'Dbg', 'Photo ' . $id . ' does not exist. ( get_photo_item )' );
634
  }
635
  return false;
636
  }
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.6.04
7
  *
8
  */
9
 
@@ -243,7 +243,7 @@ global $wppa_supported_audio_extensions;
243
  if ( ! $a && ! $p ) {
244
  $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPPA_ALBUMS."` WHERE `id` = %s", $id ) );
245
  wppa_delete_album_source( $id );
246
- wppa_flush_treecounts( $id );
247
  wppa_index_remove( 'album', $id );
248
  }
249
  break;
@@ -709,8 +709,8 @@ global $wppa_supported_audio_extensions;
709
  if ( $alb == $fromalb ) {
710
  wppa_update_photo( array( 'id' => $id, 'album' => $toalb ) );
711
  wppa_move_source( wppa_get_photo_item( $id, 'filename' ), $fromalb, $toalb );
712
- wppa_flush_treecounts( $fromalb );
713
- wppa_flush_treecounts( $toalb );
714
  $wppa_session[$slug.'_fixed']++;
715
  }
716
  break;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 6.6.09
7
  *
8
  */
9
 
243
  if ( ! $a && ! $p ) {
244
  $wpdb->query( $wpdb->prepare( "DELETE FROM `".WPPA_ALBUMS."` WHERE `id` = %s", $id ) );
245
  wppa_delete_album_source( $id );
246
+ wppa_invalidate_treecounts( $id );
247
  wppa_index_remove( 'album', $id );
248
  }
249
  break;
709
  if ( $alb == $fromalb ) {
710
  wppa_update_photo( array( 'id' => $id, 'album' => $toalb ) );
711
  wppa_move_source( wppa_get_photo_item( $id, 'filename' ), $fromalb, $toalb );
712
+ wppa_invalidate_treecounts( $fromalb );
713
+ wppa_invalidate_treecounts( $toalb );
714
  $wppa_session[$slug.'_fixed']++;
715
  }
716
  break;
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.6.07
7
  *
8
  */
9
 
@@ -539,7 +539,7 @@ global $wppa_session;
539
 
540
  // The photo views cache
541
  echo '
542
- <script type="text/javascript">';
543
  if ( isset( $wppa_session['photo'] ) ) {
544
  foreach ( array_keys( $wppa_session['photo'] ) as $p ) {
545
  echo '
@@ -547,7 +547,9 @@ global $wppa_session;
547
  }
548
  }
549
  echo '
550
- </script>
 
 
551
  <!-- end WPPA+ Footer data -->
552
  ';
553
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
+ * Version 6.6.09
7
  *
8
  */
9
 
539
 
540
  // The photo views cache
541
  echo '
542
+ <script type="text/javascript" >';
543
  if ( isset( $wppa_session['photo'] ) ) {
544
  foreach ( array_keys( $wppa_session['photo'] ) as $p ) {
545
  echo '
547
  }
548
  }
549
  echo '
550
+ </script>';
551
+
552
+ echo '
553
  <!-- end WPPA+ Footer data -->
554
  ';
555
 
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.6.05
7
  *
8
  */
9
 
@@ -88,8 +88,8 @@ global $wpdb;
88
 
89
  // A physical album
90
  else {
91
- $counts = wppa_treecount_a( $album );
92
- $count = $counts['selfphotos'] + $counts['pendphotos'];
93
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * " .
94
  "FROM `" . WPPA_PHOTOS . "` " .
95
  "WHERE `album` = %s " .
@@ -1684,8 +1684,8 @@ function wppa_album_photos_bulk( $album ) {
1684
  }
1685
  }
1686
  if ( $skip ) continue;
1687
- wppa_flush_treecounts( $photo['album'] ); // Current album
1688
- wppa_flush_treecounts( $newalb ); // New album
1689
  $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `album` = %s WHERE `id` = %s', $newalb, $id ) );
1690
  wppa_move_source( $photo['filename'], $photo['album'], $newalb );
1691
  }
@@ -1703,7 +1703,7 @@ function wppa_album_photos_bulk( $album ) {
1703
  }
1704
  if ( $skip ) continue;
1705
  wppa_copy_photo( $id, $newalb );
1706
- wppa_flush_treecounts( $newalb );
1707
  }
1708
  else wppa_error_message( 'Unexpected error #3 in wppa_album_photos_bulk().' );
1709
  break;
@@ -1715,7 +1715,7 @@ function wppa_album_photos_bulk( $album ) {
1715
  if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
1716
  if ( $status == 'publish' || $status == 'pending' || wppa_user_is( 'administrator' ) || ! wppa_switch( 'ext_status_restricted' ) ) {
1717
  $wpdb->query( "UPDATE `".WPPA_PHOTOS."` SET `status` = '".$status."' WHERE `id` = ".$id );
1718
- wppa_flush_treecounts( $id, wppa_get_photo_item( $id, 'album' ) );
1719
  }
1720
  else wp_die( 'Security check failure 2' );
1721
  }
@@ -1802,8 +1802,8 @@ echo 'Page='.$page;
1802
  wppa_show_search_statistics();
1803
  }
1804
  else {
1805
- $counts = wppa_treecount_a( $album );
1806
- $count = $counts['selfphotos'] + $counts['pendphotos'];
1807
  $photos = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `album` = %s '.wppa_get_photo_order( $album, 'norandom' ).$limit, $album ), ARRAY_A );
1808
  $link = wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album.'&bulk' );
1809
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 6.6.09
7
  *
8
  */
9
 
88
 
89
  // A physical album
90
  else {
91
+ $counts = wppa_get_treecounts_a( $album, true );
92
+ $count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
93
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT * " .
94
  "FROM `" . WPPA_PHOTOS . "` " .
95
  "WHERE `album` = %s " .
1684
  }
1685
  }
1686
  if ( $skip ) continue;
1687
+ wppa_invalidate_treecounts( $photo['album'] ); // Current album
1688
+ wppa_invalidate_treecounts( $newalb ); // New album
1689
  $wpdb->query( $wpdb->prepare( 'UPDATE `'.WPPA_PHOTOS.'` SET `album` = %s WHERE `id` = %s', $newalb, $id ) );
1690
  wppa_move_source( $photo['filename'], $photo['album'], $newalb );
1691
  }
1703
  }
1704
  if ( $skip ) continue;
1705
  wppa_copy_photo( $id, $newalb );
1706
+ wppa_invalidate_treecounts( $newalb );
1707
  }
1708
  else wppa_error_message( 'Unexpected error #3 in wppa_album_photos_bulk().' );
1709
  break;
1715
  if ( current_user_can( 'wppa_admin' ) || current_user_can( 'wppa_moderate' ) ) {
1716
  if ( $status == 'publish' || $status == 'pending' || wppa_user_is( 'administrator' ) || ! wppa_switch( 'ext_status_restricted' ) ) {
1717
  $wpdb->query( "UPDATE `".WPPA_PHOTOS."` SET `status` = '".$status."' WHERE `id` = ".$id );
1718
+ wppa_invalidate_treecounts( wppa_get_photo_item( $id, 'album' ) );
1719
  }
1720
  else wp_die( 'Security check failure 2' );
1721
  }
1802
  wppa_show_search_statistics();
1803
  }
1804
  else {
1805
+ $counts = wppa_get_treecounts_a( $album, true );
1806
+ $count = $counts['selfphotos'] + $counts['pendselfphotos'] + $counts['scheduledselfphotos'];
1807
  $photos = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM `'.WPPA_PHOTOS.'` WHERE `album` = %s '.wppa_get_photo_order( $album, 'norandom' ).$limit, $album ), ARRAY_A );
1808
  $link = wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id='.$album.'&bulk' );
1809
  }
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 6.6.07
7
  *
8
  */
9
 
@@ -2349,6 +2349,17 @@ global $wp_version;
2349
  $tags = 'cover,album,layout';
2350
  wppa_setting($slug, '8', $name, $desc, $html, $help, $clas, $tags);
2351
 
 
 
 
 
 
 
 
 
 
 
 
2352
  }
2353
  wppa_setting_subheader( 'F', '1', __( 'Widget related visibility settings' , 'wp-photo-album-plus') );
2354
  {
@@ -4059,6 +4070,21 @@ global $wp_version;
4059
  $clas = 'tt_normal';
4060
  $tags = 'thumb,layout';
4061
  wppa_setting($slug, '9', $name, $desc, $html, $help, $clas, $tags);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4062
  }
4063
  wppa_setting_subheader( 'D', '1', __( 'Album and covers related settings' , 'wp-photo-album-plus') );
4064
  {
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 6.6.09
7
  *
8
  */
9
 
2349
  $tags = 'cover,album,layout';
2350
  wppa_setting($slug, '8', $name, $desc, $html, $help, $clas, $tags);
2351
 
2352
+ $name = __('Viewcount on cover', 'wp-photo-album-plus');
2353
+ $desc = __('Show total photo viewcount on album covers.', 'wp-photo-album-plus');
2354
+ $help = '';
2355
+ $slug = 'wppa_viewcount_on_cover';
2356
+ $opts = array( __('none', 'wp-photo-album-plus'), __('top album only', 'wp-photo-album-plus'), __('total tree', 'wp-photo-album-plus'));
2357
+ $vals = array( '-none-', 'self', 'total' );
2358
+ $html = wppa_select($slug, $opts, $vals);
2359
+ $clas = '';
2360
+ $tags = 'cover,album,layout';
2361
+ wppa_setting($slug, '9', $name, $desc, $html, $help, $clas, $tags);
2362
+
2363
  }
2364
  wppa_setting_subheader( 'F', '1', __( 'Widget related visibility settings' , 'wp-photo-album-plus') );
2365
  {
4070
  $clas = 'tt_normal';
4071
  $tags = 'thumb,layout';
4072
  wppa_setting($slug, '9', $name, $desc, $html, $help, $clas, $tags);
4073
+
4074
+ $name = __('Run nl2br or wpautop on description', 'wp-photo-album-plus');
4075
+ $desc = __('Adds &lt;br> or &lt;p> and &lt;br> tags in thumbnail descriptions.', 'wp-photo-album-plus');
4076
+ $help = '';
4077
+ $slug = 'wppa_wpautop_on_thumb_desc';
4078
+ $opts = array( __('--- none ---', 'wp-photo-album-plus'),
4079
+ __('Linebreaks only', 'wp-photo-album-plus'),
4080
+ __('Linebreaks and paragraphs', 'wp-photo-album-plus'),
4081
+ );
4082
+ $vals = array('nil', 'nl2br', 'wpautop');
4083
+ $html = wppa_select($slug, $opts, $vals);
4084
+ $clas = '';
4085
+ $tags = 'thumb,layout';
4086
+ wppa_setting($slug, '10', $name, $desc, $html, $help, $clas, $tags);
4087
+
4088
  }
4089
  wppa_setting_subheader( 'D', '1', __( 'Album and covers related settings' , 'wp-photo-album-plus') );
4090
  {
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 6.6.07
7
  *
8
  */
9
 
@@ -71,6 +71,7 @@ global $silent;
71
  scheduledtm tinytext NOT NULL,
72
  custom longtext NOT NULL,
73
  crypt tinytext NOT NULL,
 
74
  PRIMARY KEY (id)
75
  ) DEFAULT CHARACTER SET utf8;";
76
 
@@ -337,7 +338,7 @@ global $silent;
337
  }
338
 
339
  if ( $old_rev <= '5308' ) {
340
- wppa_flush_treecounts();
341
  }
342
 
343
  if ( $old_rev <= '5410' ) {
@@ -494,6 +495,10 @@ global $silent;
494
  wppa_update_option( 'wppa_rating_dayly', '0' );
495
  }
496
  }
 
 
 
 
497
 
498
  }
499
 
@@ -862,6 +867,7 @@ Hide Camera info
862
  'wppa_show_cats' => 'no',
863
  'wppa_skip_empty_albums' => 'yes',
864
  'wppa_count_on_title' => '-none-',
 
865
 
866
 
867
  // E Widgets
@@ -1124,6 +1130,8 @@ Hide Camera info
1124
  'wppa_thumb_opacity' => '95',
1125
  'wppa_use_thumb_popup' => 'yes',
1126
  'wppa_align_thumbtext' => 'no',
 
 
1127
  // D Albums and covers
1128
  'wppa_list_albums_by' => '0',
1129
  'wppa_main_photo' => '0',
@@ -1942,7 +1950,7 @@ static $user;
1942
  else {
1943
  wppa_log( 'Err', 'Could not create subalbum of ' . $parent . ' for ' . $user );
1944
  }
1945
- wppa_flush_treecounts( $parent );
1946
  wppa_index_add( 'album', $id );
1947
 
1948
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 6.6.09
7
  *
8
  */
9
 
71
  scheduledtm tinytext NOT NULL,
72
  custom longtext NOT NULL,
73
  crypt tinytext NOT NULL,
74
+ treecounts text NOT NULL,
75
  PRIMARY KEY (id)
76
  ) DEFAULT CHARACTER SET utf8;";
77
 
338
  }
339
 
340
  if ( $old_rev <= '5308' ) {
341
+ wppa_invalidate_treecounts();
342
  }
343
 
344
  if ( $old_rev <= '5410' ) {
495
  wppa_update_option( 'wppa_rating_dayly', '0' );
496
  }
497
  }
498
+
499
+ if ( $old_rev <= '6609' ) {
500
+ wppa_schedule_treecount_update();
501
+ }
502
 
503
  }
504
 
867
  'wppa_show_cats' => 'no',
868
  'wppa_skip_empty_albums' => 'yes',
869
  'wppa_count_on_title' => '-none-',
870
+ 'wppa_viewcount_on_cover' => '-none-',
871
 
872
 
873
  // E Widgets
1130
  'wppa_thumb_opacity' => '95',
1131
  'wppa_use_thumb_popup' => 'yes',
1132
  'wppa_align_thumbtext' => 'no',
1133
+ 'wppa_wpautop_on_thumb_desc' => 'nil',
1134
+
1135
  // D Albums and covers
1136
  'wppa_list_albums_by' => '0',
1137
  'wppa_main_photo' => '0',
1950
  else {
1951
  wppa_log( 'Err', 'Could not create subalbum of ' . $parent . ' for ' . $user );
1952
  }
1953
+ wppa_invalidate_treecounts( $parent );
1954
  wppa_index_add( 'album', $id );
1955
 
1956
  }
wppa-statistics.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
- * Version 6.6.07
8
  *
9
  */
10
 
@@ -43,9 +43,9 @@ function wppa_get_photo_count( $id = '0', $use_treecounts = false ) {
43
  global $wpdb;
44
 
45
  if ( $use_treecounts && $id ) {
46
- $treecounts = wppa_treecount_a( $id );
47
  if ( current_user_can('wppa_moderate') ) {
48
- $count = $treecounts['selfphotos'] + $treecounts['pendphotos'] + $treecounts['scheduledphotos'];
49
  }
50
  else {
51
  $count = $treecounts['selfphotos'];
@@ -84,7 +84,7 @@ function wppa_get_album_count( $id, $use_treecounts = false ) {
84
  global $wpdb;
85
 
86
  if ( $use_treecounts && $id ) {
87
- $treecounts = wppa_treecount_a( $id );
88
  $count = $treecounts['selfalbums'];
89
  }
90
  else {
@@ -225,7 +225,7 @@ global $wppa_session;
225
  }
226
 
227
  // Bump Viewcount
228
- function wppa_bump_viewcount($type, $id) {
229
  global $wpdb;
230
  global $wppa_session;
231
 
@@ -263,6 +263,12 @@ global $wppa_session;
263
  if ( $type == 'photo' ) {
264
  wppa_set_owner_to_name( $id );
265
  }
 
 
 
 
 
 
266
  }
267
 
268
  wppa_save_session();
@@ -333,4 +339,293 @@ global $wpdb;
333
  }
334
 
335
  return $result;
336
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  *
5
  * Functions for counts etc
6
  * Common use front and admin
7
+ * Version 6.6.09
8
  *
9
  */
10
 
43
  global $wpdb;
44
 
45
  if ( $use_treecounts && $id ) {
46
+ $treecounts = wppa_get_treecounts_a( $id );
47
  if ( current_user_can('wppa_moderate') ) {
48
+ $count = $treecounts['selfphotos'] + $treecounts['pendselfphotos'] + $treecounts['scheduledselfphotos'];
49
  }
50
  else {
51
  $count = $treecounts['selfphotos'];
84
  global $wpdb;
85
 
86
  if ( $use_treecounts && $id ) {
87
+ $treecounts = wppa_get_treecounts_a( $id );
88
  $count = $treecounts['selfalbums'];
89
  }
90
  else {
225
  }
226
 
227
  // Bump Viewcount
228
+ function wppa_bump_viewcount( $type, $id ) {
229
  global $wpdb;
230
  global $wppa_session;
231
 
263
  if ( $type == 'photo' ) {
264
  wppa_set_owner_to_name( $id );
265
  }
266
+
267
+ // Mark Treecounts need update
268
+ if ( $type == 'photo' ) {
269
+ $alb = wppa_get_photo_item( $id, 'album' );
270
+ wppa_mark_treecounts( $alb );
271
+ }
272
  }
273
 
274
  wppa_save_session();
339
  }
340
 
341
  return $result;
342
+ }
343
+
344
+ // Mark treecounts of album $alb as being update required, default: clear all
345
+ function wppa_invalidate_treecounts( $alb = '' ) {
346
+ global $wpdb;
347
+
348
+ // Sanitize arg
349
+ if ( $alb ) {
350
+ $alb = strval( intval( $alb ) );
351
+ }
352
+
353
+ // Album id given
354
+ if ( $alb ) {
355
+
356
+ // Flush this albums treecounts
357
+ wppa_mark_treecounts( $alb );
358
+ }
359
+
360
+ // No album id, flush them all
361
+ else {
362
+ $iret = $wpdb->query( "UPDATE `" . WPPA_ALBUMS . "` SET `treecounts` = ''" );
363
+ if ( ! $iret ) {
364
+ wppa_log( 'Dbg', 'Unable to clear all treecounts' );
365
+ }
366
+ }
367
+ }
368
+
369
+ // Get and verify correctness of treecount values. Fix if needs update
370
+ // Essentially the same as wppa_get_treecounts_a(), but updates if needed
371
+ function wppa_verify_treecounts_a( $alb ) {
372
+ global $wpdb;
373
+
374
+ // Sanitize arg
375
+ if ( $alb ) {
376
+ $alb = strval( intval( $alb ) );
377
+ }
378
+
379
+ // Anything to do here?
380
+ if ( ! $alb ) {
381
+ return false;
382
+ }
383
+
384
+ // Get data
385
+ $treecounts = wppa_get_treecounts_a( $alb );
386
+ if ( ! $treecounts['needupdate'] ) {
387
+ return $treecounts;
388
+ }
389
+
390
+ // Get the ids of the child albums
391
+ $child_ids = $wpdb->get_col( "SELECT `id` " .
392
+ "FROM `" . WPPA_ALBUMS . "` " .
393
+ "WHERE `a_parent` = $alb"
394
+ );
395
+
396
+
397
+ // Items to compute
398
+ /*
399
+ 'needupdate',
400
+ 'selfalbums',
401
+ 'treealbums',
402
+ 'selfphotos',
403
+ 'treephotos',
404
+ 'pendselfphotos',
405
+ 'pendtreephotos',
406
+ 'scheduledselfphotos',
407
+ 'scheduledtreephotos',
408
+ 'selfphotoviews',
409
+ 'treephotoviews'
410
+ */
411
+
412
+ // Do the dirty work
413
+ $result = array();
414
+
415
+ // Need Update
416
+ $result['needupdate'] = '0';
417
+
418
+ // Self albums
419
+ $result['selfalbums'] = $wpdb->get_var( "SELECT COUNT(*) " .
420
+ "FROM `" . WPPA_ALBUMS . "` " .
421
+ "WHERE `a_parent` = $alb "
422
+ );
423
+
424
+ // Tree albums
425
+ $result['treealbums'] = $result['selfalbums'];
426
+ foreach( $child_ids as $child ) {
427
+
428
+ // Recursively get childrens tree album count and add it
429
+ $child_treecounts = wppa_verify_treecounts_a( $child );
430
+ $result['treealbums'] += $child_treecounts['treealbums'];
431
+ }
432
+
433
+ // Self photos
434
+ $result['selfphotos'] = $wpdb->get_var( "SELECT COUNT(*) " .
435
+ "FROM `" . WPPA_PHOTOS . "` " .
436
+ "WHERE `album` = $alb " .
437
+ "AND `status` <> 'pending' " .
438
+ "AND `status` <> 'scheduled'"
439
+ );
440
+
441
+ // Tree photos
442
+ $result['treephotos'] = $result['selfphotos'];
443
+ foreach( $child_ids as $child ) {
444
+
445
+ // Recursively get childrens tree photo count and add it
446
+ $child_treecounts = wppa_verify_treecounts_a( $child );
447
+ $result['treephotos'] += $child_treecounts['treephotos'];
448
+ }
449
+
450
+ // Pending self photos
451
+ $result['pendselfphotos'] = $wpdb->get_var( "SELECT COUNT(*) " .
452
+ "FROM `" . WPPA_PHOTOS . "` " .
453
+ "WHERE `album` = $alb " .
454
+ "AND `status` = 'pending'"
455
+ );
456
+
457
+ // Pending tree photos
458
+ $result['pendtreephotos'] = $result['pendselfphotos'];
459
+ foreach( $child_ids as $child ) {
460
+
461
+ // Recursively get childrens pend tree photo count and add it
462
+ $child_treecounts = wppa_verify_treecounts_a( $child );
463
+ $result['pendtreephotos'] += $child_treecounts['pendtreephotos'];
464
+ }
465
+
466
+ // Scheduled self photos
467
+ $result['scheduledselfphotos'] = $wpdb->get_var( "SELECT COUNT(*) " .
468
+ "FROM `" . WPPA_PHOTOS . "` " .
469
+ "WHERE `album` = $alb " .
470
+ "AND `status` = 'scheduled'"
471
+ );
472
+
473
+ // Scheduled tree photos
474
+ $result['scheduledtreephotos'] = $result['scheduledselfphotos'];
475
+ foreach( $child_ids as $child ) {
476
+
477
+ // Recursively get childrens scheduled tree photo views and add it
478
+ $child_treecounts = wppa_verify_treecounts_a( $child );
479
+ $result['scheduledtreephotos'] += $child_treecounts['scheduledtreephotos'];
480
+ }
481
+
482
+ // Self photo views
483
+ $views = $wpdb->get_col( "SELECT `views` FROM `" . WPPA_PHOTOS . "` WHERE `album` = $alb" );
484
+ $result['selfphotoviews'] = array_sum( $views );
485
+
486
+ // Tree photo views
487
+ $result['treephotoviews'] = $result['selfphotoviews'];
488
+ foreach( $child_ids as $child ) {
489
+
490
+ // Recursively get childrens pend tree photo views and add it
491
+ $child_treecounts = wppa_verify_treecounts_a( $child );
492
+ $result['treephotoviews'] += $child_treecounts['treephotoviews'];
493
+ }
494
+
495
+ // Save result
496
+ wppa_save_treecount_a( $alb, $result );
497
+
498
+ // Done
499
+ return $result;
500
+
501
+ }
502
+
503
+ // Set treecounts to need update
504
+ function wppa_mark_treecounts( $alb ) {
505
+
506
+ // Sanitize arg
507
+ if ( $alb ) {
508
+ $alb = strval( intval( $alb ) );
509
+ }
510
+
511
+ // Do it
512
+ if ( $alb ) {
513
+ $treecounts = wppa_get_treecounts_a( $alb );
514
+ if ( is_array( $treecounts ) ) {
515
+ $treecounts['needupdate'] = '1';
516
+ wppa_save_treecount_a( $alb, $treecounts );
517
+ $parent = wppa_get_album_item( $alb, 'a_parent' );
518
+
519
+ // Bubble up
520
+ if ( $parent > '0' ) {
521
+ wppa_mark_treecounts( $parent );
522
+ }
523
+ }
524
+ }
525
+
526
+ // Schedule cron to fix it up
527
+ wppa_schedule_treecount_update();
528
+ }
529
+
530
+ // Save update treecount array
531
+ function wppa_save_treecount_a( $alb, $treecounts ) {
532
+ global $wpdb;
533
+
534
+ // Sanitize arg
535
+ if ( $alb ) {
536
+ $alb = strval( intval( $alb ) );
537
+ }
538
+ if ( is_array( $treecounts ) ) {
539
+ foreach( array_keys( $treecounts ) as $key ) {
540
+ $treecounts[$key] = strval( intval( $treecounts[$key] ) );
541
+ }
542
+ }
543
+
544
+ // Do it
545
+ if ( $alb && is_array( $treecounts ) ) {
546
+
547
+ $keys = array( '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '10' );
548
+ $result = array_combine( $keys, $treecounts );
549
+ $result = serialize( $result );
550
+
551
+ $iret = $wpdb->query( "UPDATE `" . WPPA_ALBUMS . "` SET `treecounts` = '$result' WHERE `id` = $alb" );
552
+ wppa_cache_album( 'invalidate', $alb );
553
+ }
554
+ }
555
+
556
+ // Get the treecounts for album $alb
557
+ function wppa_get_treecounts_a( $alb, $update = false ) {
558
+ global $wpdb;
559
+
560
+ // Array index defintions
561
+ $needupdate = '0';
562
+ $selfalbums = '1';
563
+ $treealbums = '2';
564
+ $selfphotos = '3';
565
+ $treephotos = '4';
566
+ $pendselfphotos = '5';
567
+ $pendtreephotos = '6';
568
+ $scheduledselfphotos = '7';
569
+ $scheduledtreephotos = '8';
570
+ $selfphotoviews = '9';
571
+ $treephotoviews = '10';
572
+
573
+ // Sanitize arg
574
+ if ( $alb ) {
575
+ $alb = strval( intval( $alb ) );
576
+ }
577
+
578
+ // If album id given
579
+ if ( $alb ) {
580
+
581
+ // Get db data field
582
+ $treecount_string = wppa_get_album_item( $alb, 'treecounts' );
583
+
584
+ // Convert to array
585
+ if ( $treecount_string ) {
586
+ $treecount_array = unserialize( $treecount_string );
587
+ }
588
+ else {
589
+ $treecount_array = array();
590
+ }
591
+
592
+ // Fill in missing elements
593
+ $defaults = array( 1,0,0,0,0,0,0,0,0,0,0 );
594
+ $i = 0;
595
+ $n = count( $defaults );
596
+ while ( $i < $n ) {
597
+ if ( ! isset( $treecount_array[$i] ) ) {
598
+ $treecount_array[$i] = $defaults[$i];
599
+ }
600
+ $i++;
601
+ }
602
+
603
+ // Convert numeric keys to alphabetic keys
604
+ $keys = array( 'needupdate',
605
+ 'selfalbums',
606
+ 'treealbums',
607
+ 'selfphotos',
608
+ 'treephotos',
609
+ 'pendselfphotos',
610
+ 'pendtreephotos',
611
+ 'scheduledselfphotos',
612
+ 'scheduledtreephotos',
613
+ 'selfphotoviews',
614
+ 'treephotoviews'
615
+ );
616
+
617
+ $result = array_combine( $keys, $treecount_array );
618
+
619
+ if ( $result['needupdate'] && $update ) {
620
+ return wppa_verify_treecounts_a( $alb );
621
+ }
622
+ }
623
+
624
+ // No album given
625
+ else {
626
+ $result = false;
627
+ }
628
+
629
+ // Done
630
+ return $result;
631
+ }
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.6.05
9
  *
10
  */
11
 
@@ -694,6 +694,15 @@ global $wpdb;
694
  $desc .= wppa_moderate_links( 'thumb', $id );
695
  }
696
  $desc .= wppa_get_photo_desc( $id, wppa_switch( 'allow_foreign_shortcodes_thumbs' ) );
 
 
 
 
 
 
 
 
 
697
  $result .= '<div' .
698
  ' class="wppa-thumb-text"' .
699
  ' style="'.__wcs( 'wppa-thumb-text' ).'"' .
@@ -846,6 +855,15 @@ global $thlinkmsggiven;
846
  $desc = wppa_get_photo_desc( $id );
847
  if ( in_array( $thumb['status'], array( 'pending', 'scheduled' ) ) ) $desc .= wppa_moderate_links( 'thumb', $id );
848
 
 
 
 
 
 
 
 
 
 
849
  $result .= '<p' .
850
  ' class="wppa-box-text wppa-black"' .
851
  ' style="' . __wcs( 'wppa-box-text' ) . __wcs( 'wppa-black' ) .
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
+ * Version 6.6.09
9
  *
10
  */
11
 
694
  $desc .= wppa_moderate_links( 'thumb', $id );
695
  }
696
  $desc .= wppa_get_photo_desc( $id, wppa_switch( 'allow_foreign_shortcodes_thumbs' ) );
697
+
698
+ // Run wpautop on description?
699
+ if ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'wpautop' ) {
700
+ $desc = wpautop( $desc );
701
+ }
702
+ elseif ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'nl2br' ) {
703
+ $desc = nl2br( $desc );
704
+ }
705
+
706
  $result .= '<div' .
707
  ' class="wppa-thumb-text"' .
708
  ' style="'.__wcs( 'wppa-thumb-text' ).'"' .
855
  $desc = wppa_get_photo_desc( $id );
856
  if ( in_array( $thumb['status'], array( 'pending', 'scheduled' ) ) ) $desc .= wppa_moderate_links( 'thumb', $id );
857
 
858
+ // Run wpautop on description?
859
+ if ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'wpautop' ) {
860
+ $desc = wpautop( $desc );
861
+ }
862
+ elseif ( wppa_opt( 'wpautop_on_thumb_desc' ) == 'nl2br' ) {
863
+ $desc = nl2br( $desc );
864
+ }
865
+
866
+
867
  $result .= '<p' .
868
  ' class="wppa-box-text wppa-black"' .
869
  ' style="' . __wcs( 'wppa-box-text' ) . __wcs( 'wppa-black' ) .
wppa-upload.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
- * Version 6.5.03
7
  *
8
  */
9
 
@@ -138,16 +138,31 @@ global $upload_album;
138
 
139
  // check if albums exist before allowing upload
140
  if ( ! wppa_has_albums() ) {
141
- $url = wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu' );
142
- echo
143
- '<p>' .
144
- __( 'No albums exist. You must' , 'wp-photo-album-plus') .
145
- ' <a href="' . $url . '" >' .
146
- __( 'create one' , 'wp-photo-album-plus') .
147
- '</a> ' .
148
- __( 'before you can upload your photos.', 'wp-photo-album-plus' ) .
149
- '</p>' . '</div>';
150
- return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  }
152
 
153
  // Upload One only configured and not administrator or super user?
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
+ * Version 6.6.09
7
  *
8
  */
9
 
138
 
139
  // check if albums exist before allowing upload
140
  if ( ! wppa_has_albums() ) {
141
+
142
+ // User can create
143
+ if ( current_user_can( 'wppa_admin' ) ) {
144
+ $url = wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu' );
145
+ echo
146
+ '<p>' .
147
+ __( 'No albums exist. You must' , 'wp-photo-album-plus') .
148
+ ' <a href="' . $url . '" >' .
149
+ __( 'create one' , 'wp-photo-album-plus') .
150
+ '</a> ' .
151
+ __( 'before you can upload your photos.', 'wp-photo-album-plus' ) .
152
+ '</p>' . '</div>';
153
+ return;
154
+ }
155
+
156
+ // User can not create
157
+ else {
158
+ echo
159
+ '<p>' .
160
+ __( 'There are no albums where you are allowed to upload photos to.', 'wp-photo-album-plus' ) .
161
+ '<br />' .
162
+ __( 'Ask your administrator to create at least one album that is accessable for you to upload to, or ask him to give you album admin rights.', 'wp-photo-album-plus' ) .
163
+ '</p>';
164
+ return;
165
+ }
166
  }
167
 
168
  // Upload One only configured and not administrator or super user?
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 6.6.08
7
  *
8
  */
9
 
@@ -1006,148 +1006,6 @@ function wppa_get_imgalt( $id, $lb = false ) {
1006
  return $result;
1007
  }
1008
 
1009
- // Flush treecounts of album $alb, default: clear all
1010
- function wppa_flush_treecounts( $alb = '' ) {
1011
- global $wppa;
1012
-
1013
- if ( $alb ) {
1014
- $wppa['counts'] = WPPA_MULTISITE_GLOBAL ? get_site_option( 'wppa_counts', array() ) : get_option( 'wppa_counts', array() );
1015
- $wppa['treecounts'] = WPPA_MULTISITE_GLOBAL ? get_site_option( 'wppa_counts_tree', array() ) : get_option( 'wppa_counts_tree', array() );
1016
- if ( isset($wppa['counts'][$alb]) ) {
1017
- unset($wppa['counts'][$alb]);
1018
- $iret = WPPA_MULTISITE_GLOBAL ? update_site_option('wppa_counts', $wppa['counts']) : update_option('wppa_counts', $wppa['counts']);
1019
- }
1020
- if ( isset($wppa['treecounts'][$alb]) ) {
1021
- unset($wppa['treecounts'][$alb]);
1022
- $uret = WPPA_MULTISITE_GLOBAL ? update_site_option('wppa_counts_tree', $wppa['treecounts']) : update_option('wppa_counts_tree', $wppa['treecounts']);
1023
- }
1024
- $parent = wppa_get_parentalbumid($alb);
1025
- if ( $parent > '0' ) wppa_flush_treecounts($parent);
1026
- }
1027
- else {
1028
- $bret = WPPA_MULTISITE_GLOBAL ? delete_site_option( 'wppa_counts' ) : delete_option( 'wppa_counts' );
1029
- $bret = WPPA_MULTISITE_GLOBAL ? delete_site_option( 'wppa_counts_tree' ) : delete_option( 'wppa_counts_tree' );
1030
- }
1031
- }
1032
-
1033
- // Verify correctness of treecount value
1034
- function wppa_verify_treecounts( $alb, $key, $count ) {
1035
-
1036
- $treecounts = wppa_treecount_a( $alb );
1037
- $need_a = false;
1038
- $need_p = false;
1039
-
1040
- // Number of albums ( $count ) equal to subalbums ( 'selfalbums' ) ?
1041
- if ( 'albums' == $key ) {
1042
- if ( $treecounts['selfalbums'] != $count ) { // Faulty data
1043
- $need_a = true;
1044
- }
1045
- }
1046
-
1047
- // Number of photos ( $count ) equal to photos in this album ( 'selfphotos' ( + opts ) )?
1048
- if ( 'photos' == $key ) {
1049
- if ( current_user_can( 'wppa_moderate' ) ) {
1050
- if ( ( $treecounts['selfphotos'] + $treecounts['pendphotos'] + $treecounts['scheduledphotos'] ) != $count ) { // Faulty data
1051
- $need_p = true;
1052
- }
1053
- }
1054
- else {
1055
- if ( $treecounts['selfphotos'] != $count ) { // Faulty data
1056
- $need_p = true;
1057
- }
1058
- }
1059
- }
1060
-
1061
- // If no sub-albums, total number of photos should be equal to photos in this album ( 'selfphotos' )
1062
- if ( ! $treecounts['selfalbums'] && $treecounts['photos'] != $treecounts['selfphotos'] ) {
1063
- $need_p = true;
1064
- }
1065
-
1066
- // Need recalc for reason albums fault?
1067
- if ( $need_a ) {
1068
- wppa_flush_treecounts( $alb );
1069
- wppa_log( 'Fix', 'Treecounts albums for album #'.$alb.' ('.wppa_get_album_name( $alb ).')' );
1070
- }
1071
-
1072
- // Need recalc for reason photos fault?
1073
- if ( $need_p ) {
1074
- wppa_flush_treecounts( $albumid );
1075
- wppa_log( 'Fix', 'Treecounts photos for album #'.$alb.' ('.wppa_get_album_name( $alb ).')' );
1076
- }
1077
- }
1078
-
1079
- // Get the treecounts for album $alb
1080
- function wppa_treecount_a( $alb ) {
1081
- global $wpdb;
1082
- global $wppa;
1083
-
1084
- $albums = '0';
1085
- $photos = '1';
1086
- $selfalbums = '3';
1087
- $selfphotos = '4';
1088
- $pendphotos = '5';
1089
- $scheduledphotos = '6';
1090
-
1091
- // Initial fetch
1092
- if ( ! isset($wppa['counts']) ) {
1093
- $wppa['counts'] = WPPA_MULTISITE_GLOBAL ? get_site_option( 'wppa_counts', array() ) : get_option( 'wppa_counts', array() );
1094
- }
1095
- if ( ! isset($wppa['treecounts']) ) {
1096
- $wppa['treecounts'] = WPPA_MULTISITE_GLOBAL ? get_site_option( 'wppa_counts_tree', array() ) : get_option( 'wppa_counts_tree', array() );
1097
- }
1098
-
1099
- // See if we have this in cache
1100
- if ( isset( $wppa['counts'][$alb] ) && isset( $wppa['treecounts'][$alb] ) ) { // Album found
1101
- $result['albums'] = $wppa['treecounts'][$alb][$albums]; // Use data
1102
- $result['photos'] = $wppa['treecounts'][$alb][$photos];
1103
- $result['selfalbums'] = $wppa['counts'][$alb][$selfalbums];
1104
- $result['selfphotos'] = $wppa['counts'][$alb][$selfphotos];
1105
- $result['pendphotos'] = $wppa['counts'][$alb][$pendphotos];
1106
- $result['scheduledphotos'] = $wppa['counts'][$alb][$scheduledphotos];
1107
-
1108
- return $result; // And return
1109
- }
1110
-
1111
- // Not in cache
1112
- else {
1113
- $albs = $wpdb->get_results( $wpdb->prepare( "SELECT `id` FROM `".WPPA_ALBUMS."` WHERE `a_parent` = %s", $alb ), ARRAY_A );
1114
- $album_count = empty($albs) ? '0' : count($albs);
1115
- $photo_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_PHOTOS."` WHERE `album` = %s AND `status` <> 'pending' AND `status` <> 'scheduled'", $alb ) );
1116
- $pend_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_PHOTOS."` WHERE `album` = %s AND `status` = 'pending'", $alb ) );
1117
- $sched_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_PHOTOS."` WHERE `album` = %s AND `status` = 'scheduled'", $alb ) );
1118
-
1119
- // Result this level
1120
- $result = array( 'albums' => $album_count,
1121
- 'photos' => $photo_count,
1122
- 'selfalbums' => $album_count,
1123
- 'selfphotos' => $photo_count,
1124
- 'pendphotos' => $pend_count,
1125
- 'scheduledphotos' => $sched_count,
1126
- );
1127
-
1128
- // Subalbums to process?
1129
- if ( empty($albs) ) {}
1130
- else {
1131
- foreach ( $albs as $albm ) {
1132
- $subcount = wppa_treecount_a($albm['id']);
1133
- $result['albums'] += $subcount['albums'];
1134
- $result['photos'] += $subcount['photos'];
1135
- }
1136
- }
1137
-
1138
- // Save to cache
1139
- $wppa['treecounts'][$alb][$albums] = $result['albums'];
1140
- $wppa['treecounts'][$alb][$photos] = $result['photos'];
1141
- $wppa['counts'][$alb][$selfalbums] = $result['selfalbums'];
1142
- $wppa['counts'][$alb][$selfphotos] = $result['selfphotos'];
1143
- $wppa['counts'][$alb][$pendphotos] = $result['pendphotos'];
1144
- $wppa['counts'][$alb][$scheduledphotos] = $result['scheduledphotos'];
1145
- $bret = WPPA_MULTISITE_GLOBAL ? update_site_option( 'wppa_counts', $wppa['counts'] ) : update_option( 'wppa_counts', $wppa['counts'] );
1146
- $bret = WPPA_MULTISITE_GLOBAL ? update_site_option( 'wppa_counts_tree', $wppa['treecounts'] ) : update_option( 'wppa_counts_tree', $wppa['treecounts'] );
1147
-
1148
- return $result;
1149
- }
1150
- }
1151
 
1152
  function wppa_is_time_up($count = '') {
1153
  global $wppa_starttime;
@@ -1403,7 +1261,7 @@ global $wpdb;
1403
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_COMMENTS.'` WHERE `photo` = %s', $photo));
1404
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_IPTC.'` WHERE `photo` = %s', $photo));
1405
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_EXIF.'` WHERE `photo` = %s', $photo));
1406
- wppa_flush_treecounts($album);
1407
  wppa_flush_upldr_cache('photoid', $photo);
1408
 
1409
  // Delete from cloud
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 6.6.09
7
  *
8
  */
9
 
1006
  return $result;
1007
  }
1008
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1009
 
1010
  function wppa_is_time_up($count = '') {
1011
  global $wppa_starttime;
1261
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_COMMENTS.'` WHERE `photo` = %s', $photo));
1262
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_IPTC.'` WHERE `photo` = %s', $photo));
1263
  $wpdb->query($wpdb->prepare('DELETE FROM `'.WPPA_EXIF.'` WHERE `photo` = %s', $photo));
1264
+ wppa_invalidate_treecounts($album);
1265
  wppa_flush_upldr_cache('photoid', $photo);
1266
 
1267
  // Delete from cloud
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.6.08
7
  *
8
  */
9
 
@@ -362,7 +362,8 @@ global $wpdb;
362
  'views' => '0',
363
  'cats' => '',
364
  'scheduledtm' => '',
365
- 'crypt' => wppa_get_unique_album_crypt()
 
366
  ) );
367
 
368
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
@@ -387,9 +388,10 @@ global $wpdb;
387
  `views`,
388
  `cats`,
389
  `scheduledtm`,
390
- `crypt`
 
391
  )
392
- VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s ,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
393
  $args['id'],
394
  trim( $args['name'] ),
395
  trim( $args['description'] ),
@@ -410,12 +412,17 @@ global $wpdb;
410
  $args['views'],
411
  $args['cats'],
412
  $args['scheduledtm'],
413
- $args['crypt']
 
414
  );
415
- $iret = $wpdb->query($query);
416
 
417
- if ( $iret ) return $args['id'];
418
- else return false;
 
 
 
 
419
  }
420
 
421
  // Find the next available id in a table
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
+ * Version 6.6.09
7
  *
8
  */
9
 
362
  'views' => '0',
363
  'cats' => '',
364
  'scheduledtm' => '',
365
+ 'crypt' => wppa_get_unique_album_crypt(),
366
+ 'treecounts' => serialize( array( 1,0,0,0,0,0,0,0,0,0,0 ) )
367
  ) );
368
 
369
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
388
  `views`,
389
  `cats`,
390
  `scheduledtm`,
391
+ `crypt`,
392
+ `treecounts`
393
  )
394
+ VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s ,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
395
  $args['id'],
396
  trim( $args['name'] ),
397
  trim( $args['description'] ),
412
  $args['views'],
413
  $args['cats'],
414
  $args['scheduledtm'],
415
+ $args['crypt'],
416
+ $args['treecounts']
417
  );
418
+ $iret = $wpdb->query( $query );
419
 
420
+ if ( $iret ) {
421
+ wppa_invalidate_treecounts( $args['id'] );
422
+ return $args['id'];
423
+ }
424
+
425
+ return false;
426
  }
427
 
428
  // Find the next available id in a table
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.6.08
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 = '6608'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '6-6-08-005'; // 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.6.09
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 = '6609'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '6-6-09-004'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime(true);