WP Photo Album Plus - Version 7.1.00.004

Version Description

= 7.1.00 =

  • This version addresses various bug fixes and feature requests.
  • The Photo Album -> Upload Photos and Import Photos admin pages have been substantially improved. Read the changelog for details.

= 7.0.11 =

  • This version addresses various bug fixes and feature requests.

= 7.0.11 =

  • This version addresses various bug fixes

= 7.0.10 =

  • This version addresses various bug fixes

= 7.0.09 =

  • This version addresses various security issues.
  • This version addresses various bug fixes and feature requests.

= 7.0.08 =

  • This version addresses various security issues.
  • This version addresses various bug fixes

= 7.0.07 =

  • This version addresses various security issues.
  • This version addresses various bug fixes

= 7.0.06 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.05 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 7.0.04 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.03 =

  • This version addresses various minor bug fixes and feature requests.

= 7.0.02 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.01 =

  • This version addresses various minor bug fixes and feature requests.

= 7.0.00 =

  • Shortcode generators for Gutenberg added.
  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.
  • To prevent spamming and give the users the opportunity to decide when they want us to email them, the mailing system has been revised. Configure Table IX-M to enable various mailing lists, and use the WPPA+ Notify widget for full user flexibility.

= 6.9.21 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 6.9.20 =

  • This version addresses various bug fixes

= 6.9.19 =

  • This version addresses various minor bug fixes

= 6.9.18 =

  • This version addresses various minor bug fixes

= 6.9.17 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.16 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.15 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.14 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.13 =

  • Security release.

= 6.9.12 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.11 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.10 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.09 =

  • Panorama support phase III.

= 6.9.08 =

  • This version addresses various minor bug fixes and feature requests.
  • Panorama support phase II.

= 6.9.07 =

  • This version addresses various minor bug fixes and feature requests.
  • Panorama support phase I.

= 6.9.06 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.05 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.04 =

  • This version addresses various minor bug fixes and feature requests.
  • Local CDN functionality has been added.

= 6.9.03 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.02 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.01 =

  • This version addresses various minor bug fixes and feature requests.

= 6.9.00 =

  • This version includes the code for the privacy policy requirements.

= 6.8.09

  • This version addresses various bug fixes and code edits.

= 6.8.08 =

  • This version addresses various minor bug fixes and feature requests.
  • This version offers substantial performance improvements when the box in Table IV-A13: Defer Javascript is ticked. This setting is now recommended and set ticked as the default.
  • For more info on performance improvements and compatibility with optimizers: see the changelog.txt

= 6.8.07 =

  • This version addresses various minor bug fixes and enhancements, and a new widget: Statistics.

= 6.8.06 =

  • This version addresses various minor bug fixes and improved cache handling.

= 6.8.05 =

  • This version addresses various minor bug fixes and feture requests.

= 6.8.04 =

  • This version addresses various display issues and a few fixes of bugs that seldom affected the plugins behaviour.
Download this release

Release Info

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

Code changes from version 7.1.00.002 to 7.1.00.004

changelog.txt CHANGED
@@ -6,11 +6,15 @@ WP Photo Album Plus Changelog
6
  The sequence order of video/audio/pdf files and their respective poster files is no longer important,
7
  so you can add an image to a mediafile as well as add a mediafile to an image,
8
  provided the filenames except extensions are identical.
9
- If you upload a zipfile with a directory structure,
10
  this structure will be created as a sub-album structure if it does not already exist, and the items will be placed in the sub(sub) albums accordingly.
11
  You may even upload zipfiles with embedded zipfiles.
 
 
12
  * The audio stub file was overwritten by the most recently uploaded audio posterfile. Fixed.
13
  * Fixed a situation where the THREE.js file was erroneously not loaded, e.g. when going with ajax to a 360 display from a page without 360 images.
 
 
14
 
15
  = 7.0.12 =
16
 
6
  The sequence order of video/audio/pdf files and their respective poster files is no longer important,
7
  so you can add an image to a mediafile as well as add a mediafile to an image,
8
  provided the filenames except extensions are identical.
9
+ If you upload a zipfile with a directory structure,
10
  this structure will be created as a sub-album structure if it does not already exist, and the items will be placed in the sub(sub) albums accordingly.
11
  You may even upload zipfiles with embedded zipfiles.
12
+ * The Photo Albums -> Import Photos admin page now also supports document files of type pdf.
13
+ The sequence order of importing documents and poster image files is not important.
14
  * The audio stub file was overwritten by the most recently uploaded audio posterfile. Fixed.
15
  * Fixed a situation where the THREE.js file was erroneously not loaded, e.g. when going with ajax to a 360 display from a page without 360 images.
16
+ * When the available display space for thumbnails was smaller than the thumbnail size, the thumbnail was displayed off the screen. Fixed.
17
+ * The 'Default photo name' method as selected in Table IX-D13 is now also applied when importing photos etc.
18
 
19
  = 7.0.12 =
20
 
js/wppa.js CHANGED
@@ -2,7 +2,7 @@
2
  //
3
  // conatins common vars and functions
4
  //
5
- var wppaJsVersion = '7.0.07';
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!!
@@ -606,14 +606,11 @@ function _wppaDoAutocol( mocc, i ) {
606
  if ( tfw ) {
607
  var minspc = wppaMinThumbSpace;
608
  var weff = w - wppaThumbnailAreaDelta - 7;
609
- var nthumbs = parseInt( weff / ( tfw + minspc ) );
610
  var availsp = weff - nthumbs * tfw;
611
  var newspc = parseInt( 0.5 + availsp / ( nthumbs+1 ) );
612
 
613
- var oldspc = jQuery( "" ).css( 'marginLeft' );
614
- if ( oldspc != newspc ) {
615
- jQuery( ".thumbnail-frame-"+mocc ).css( {marginLeft:newspc});
616
- }
617
  }
618
  }
619
 
2
  //
3
  // conatins common vars and functions
4
  //
5
+ var wppaJsVersion = '7.1.00';
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!!
606
  if ( tfw ) {
607
  var minspc = wppaMinThumbSpace;
608
  var weff = w - wppaThumbnailAreaDelta - 7;
609
+ var nthumbs = Math.max( 1, parseInt( weff / ( tfw + minspc ) ) );
610
  var availsp = weff - nthumbs * tfw;
611
  var newspc = parseInt( 0.5 + availsp / ( nthumbs+1 ) );
612
 
613
+ jQuery( ".thumbnail-frame-"+mocc ).css( {marginLeft:newspc});
 
 
 
614
  }
615
  }
616
 
js/wppa.min.js CHANGED
@@ -1 +1 @@
1
- var wppaJsVersion="7.0.07",wppaVersion="0",wppaIsIe=!1,wppaUseSvg=!0,wppaDebug,wppaFullValign=[],wppaFullHalign=[],wppaFullFrameDelta=[],wppaAnimationSpeed,wppaImageDirectory,wppaThumbnailAreaDelta;if(!wppaAutoColumnWidth)var wppaAutoColumnWidth=[];if(!wppaAutoColumnFrac)var wppaAutoColumnFrac=[];var wppaSlideShowTimeOut=2500,wppaFadeInAfterFadeOut=!1,wppaTextFrameDelta=0,wppaBoxDelta=0,wppaPreambule=[],wppaHideWhenEmpty=!1,wppaThumbnailPitch=[],wppaFilmStripLength=[],wppaFilmStripMargin=[],wppaFilmStripAreaDelta=[],wppaFilmShowGlue=!1,wppaIsMini=[],wppaPortraitOnly=[],wppaSlideShow,wppaPhoto,wppaOf,wppaNextPhoto,wppaPreviousPhoto,wppaNextP,wppaPrevP,wppaAvgRating,wppaMyRating,wppaAvgRat,wppaMyRat,wppaDislikeMsg,wppaMiniTreshold=300,wppaStart="Start",wppaStop="Stop",wppaPleaseName,wppaPleaseEmail,wppaPleaseComment,wppaRatingOnce=!0,wppaBGcolorNumbar="transparent",wppaBcolorNumbar="transparent",wppaBGcolorNumbarActive="transparent",wppaBcolorNumbarActive="transparent",wppaFontFamilyNumbar="",wppaFontSizeNumbar="",wppaFontColorNumbar="",wppaFontWeightNumbar="",wppaFontFamilyNumbarActive="",wppaFontSizeNumbarActive="",wppaFontColorNumbarActive="",wppaFontWeightNumbarActive="",wppaNumbarMax="10",wppaAjaxUrl="",wppaLang="",wppaNextOnCallback=!1,wppaStarOpacity=.2,wppaLightBox=[],wppaEmailRequired="required",wppaSlideBorderWidth=0,wppaSlideInitRunning=[],wppaAnimationType="fadeover",wppaSlidePause=[],wppaSlideBlank=[],wppaRatingMax=5,wppaRatingDisplayType="graphic",wppaRatingPrec=2,wppaFilmPageSize=[],wppaAspectRatio=[],wppaFullSize=[],wppaStretch=!1,wppaThumbSpaceAuto=!1,wppaMinThumbSpace=4,wppaMagnifierCursor="",wppaArtMonkyLink="none",wppaAutoOpenComments=!1,wppaUpdateAddressLine=!1,wppaFilmThumbTitle="",wppaClickToView="",wppaUploadUrl="",wppaVoteForMe="",wppaVotedForMe="",wppaSlideSwipe=!0,wppaLightboxSingle=[],wppaMaxCoverWidth=300,wppaDownLoad="Download",wppaSiteUrl="",wppaWppaUrl="",wppaIncludeUrl="",wppaSlideToFullpopup=!1,wppaComAltSize=75,wppaBumpViewCount=!0,wppaBumpClickCount=!1,wppaFotomoto=!1,wppaArtMonkeyButton=!0,wppaShortQargs=!1,wppaOvlHires=!1,wppaMasonryCols=[],wppaVideoPlaying=[],wppaAudioPlaying=[],wppaSlideVideoStart=!1,wppaSlideAudioStart=!1,wppaAudioHeight=28,wppaHis=0,wppaStartHtml=[],wppaCanAjaxRender=!1,wppaCanPushState=!1,wppaAllowAjax=!0,wppaMaxOccur=0,wppaFirstOccur=0,wppaUsePhotoNamesInUrls=!1,wppaShareHideWhenRunning=!1,wppaCommentRequiredAfterVote=!0,wppaTopMoc=0;if(!wppaColWidth)var wppaColWidth=[];var wppaFotomotoHideWhenRunning=!1,wppaFotomotoMinWidth=400,wppaPhotoView=[],wppaBackgroundColorImage="",wppaPopupLinkType="",wppaPopupOnclick=[],wppaThumbTargetBlank=!1,wppaRel="rel",wppaEditPhotoWidth="960",wppaThemeStyles="",wppaStickyHeaderHeight=0,wppaRenderModal=!1,wppaModalBgColor="#ffffff",wppaBoxRadius=0,wppaModalQuitImg,wppaUploadEdit="none",wppaPageArg="",wppaSlideshowNavigationType="icons",wppaCoverImageResponsive=[],wppaSearchBoxSelItems=[],wppaSlideWrap=[],wppaHideRightClick=!1,wppaProcessing="Processing...",wppaDone="Done!",wppaUploadFailed="Upload failed",wppaServerError="Server error",wppaGeoZoom=10,wppaLazyLoad=!0,wppaThumbAreaMaxFrac=1,wppaNiceScroll=!1,wppaIconSizeNormal="default",wppaIconSizeSlide=48,wppaIconSizeStars=24,wppaResponseSpeed=500,_wppaId=[],_wppaAvg=[],_wppaDisc=[],_wppaMyr=[],_wppaVRU=[],_wppaLinkUrl=[],_wppaLinkTitle=[],_wppaLinkTarget=[],_wppaCommentHtml=[],_wppaIptcHtml=[],_wppaExifHtml=[],_wppaToTheSame=!1,_wppaSlides=[],_wppaNames=[],_wppaFullNames=[],_wppaDsc=[],_wppaOgDsc=[],_wppaCurIdx=[],_wppaNxtIdx=[],_wppaTimeOut=[],_wppaSSRuns=[],_wppaFg=[],_wppaTP=[],_wppaIsBusy=[],_wppaFirst=[],_wppaVoteInProgress=!1,_wppaTextDelay,_wppaUrl=[],_wppaSkipRated=[],_wppaLbTitle=[],_wppaStateCount=0,_wppaDidGoto=[],_wppaShareUrl=[],_wppaShareHtml=[],_wppaFilmNoMove=[],_wppaHiresUrl=[],_wppaIsVideo=[],_wppaVideoHtml=[],_wppaAudioHtml=[],_wppaVideoNatWidth=[],_wppaVideoNatHeight=[],_wppaWaitTexts=[],_wppaImageAlt=[],_wppaSavedWidth=0,_wppaSavedHeight=0,__wppaOverruleRun=!1,wppaOvlUrls,wppaOvlTitles,wppaOvlAlts,wppaOvlIdx=0,wppaOvlFirst=!0,wppaOvlKbHandler="",wppaOvlSizeHandler="",wppaOvlPadTop=5,wppaOvlIsSingle,wppaOvlRunning=!1,wppaOvlVideoHtmls,wppaOvlAudioHtmls,wppaOvlVideoNaturalWidths,wppaOvlVideoNaturalHeights,wppaOvlModeInitial="normal",wppaOvlVideoPlaying=!1,wppaOvlAudioPlaying=!1,wppaOvlShowLegenda=!0,wppaOvlShowStartStop=!0,wppaOvlRadius=0,wppaOvlBorderWidth=16,wppaOvlOpen=!1,wppaOvlTxtHeight=36,wppaOvlOpacity=.8,wppaOvlOnclickType="none",wppaOvlTheme="black",wppaOvlAnimSpeed=300,wppaOvlSlideSpeed=3e3,wppaVer4WindowWidth=800,wppaVer4WindowHeight=600,wppaOvlFontFamily="Helvetica",wppaOvlFontSize="10",wppaOvlFontColor="",wppaOvlFontWeight="bold",wppaOvlLineHeight="12",wppaOvlShowCounter=!0,wppaOvlIsVideo=!1,wppaShowLegenda="",wppaOvlFsPhotoId=0,wppaPhotoId=0,wppaOvlVideoStart=!1,wppaOvlAudioStart=!1,wppaLastIptc="",wppaLastExif="",wppaIsMobile=!1,wppaSvgFillcolor="gray",wppaSvgBgcolor="transparent",wppaSvgCornerStyle="light";function wppaDoInit(){_wppaTextDelay=wppaAnimationSpeed,wppaFadeInAfterFadeOut&&(_wppaTextDelay*=2),jQuery(".wppa-ajax-spin").stop().fadeOut(),jQuery(".wppa-ovl-spin").hide(),setTimeout(function(){for(var p=1;p<wppaTopMoc;)jQuery("#ubb-"+p+"-l")&&(wppaUbb(p,"l","hide"),wppaUbb(p,"r","hide")),p++},3e3),jQuery(window).on("DOMContentLoaded load resize orientationchange",wppaDoAllAutocols),jQuery(window).on("DOMContentLoaded load resize scroll",wppaSizeThumbArea),jQuery(window).on("DOMContentLoaded load resize scroll",wppaMakeLazyVisible),jQuery(window).trigger("resize"),wppaProtect()}function wppaSizeAutoDiv(){jQuery(".wppa-autodiv").each(function(p){var a=jQuery(window).height(),e=jQuery(this).attr("data-max-height");jQuery(this).css({maxHeight:a*e})})}function wppaDoAllAutocols(p){for("number"!=typeof p&&(p=1),wppaConsoleLog("Doing wppaDoAllAutocols "+p),mocc=1;mocc<=wppaTopMoc;mocc++)wppaAutoColumnWidth[mocc]&&_wppaDoAutocol(mocc,p);p++;var a=wppaWindowWidth(),e=wppaWindowHeight();a!=_wppaSavedWidth&&e!=_wppaSavedHeight&&setTimeout(function(){wppaDoAllAutocols(p)},100),_wppaSavedWidth=a,_wppaSavedHeight=e}function wppaProtect(){wppaHideRightClick&&(jQuery("img").bind("contextmenu",function(p){return!1}),jQuery("video").bind("contextmenu",function(p){return!1}))}function wppaUpdateLightboxes(){"function"==typeof wppaInitOverlay&&wppaInitOverlay(),"undefined"!=typeof myLightbox&&"function"==typeof myLightbox.updateImageList&&myLightbox.updateImageList(),jQuery().prettyPhoto&&jQuery("a[rel^='prettyPhoto']").prettyPhoto({deeplinking:!1})}function wppaStopVideo(p){var a,e,t=[];for(t[1]="wppa-overlay-img",t[2]="theimg0-"+p,t[3]="theimg1-"+p,e=0;e<3;)1==++e&&0!=p||(a=document.getElementById(t[e]))&&"function"==typeof a.pause&&(a.pause(),wppaConsoleLog("Video "+t[e]+" paused","force"))}function wppaStopAudio(p){if("number"==typeof p)jQuery("#audio-"+p).pause&&jQuery("#audio-"+p).pause();else{var a=jQuery("audio");if(0<a.length)for(var e=0;e<a.length;)"wppa"==jQuery(a[e]).attr("data-from")&&a[e].pause(),e++}}function wppaMakeFullsizeUrl(p){var a,e;(a=(p=p.replace("/thumbs/","/")).split("//"))[1]?(e=a[1].split("/"),p=a[0]+"//"):(e=a[0].split("/"),p="");for(var t=0;t<e.length;){var o=e[t];"w"!=o.split("_")[0]&&(0!=t&&(p+="/"),p+=o),t++}return p}function wppaGetContainerWidth(p){var a=document.getElementById("wppa-container-"+p),e=0;if(!wppaAutoColumnWidth[p])return a.clientWidth;for(;0==e;)a=a.parentNode,e=jQuery(a).width();return parseInt(e*wppaAutoColumnFrac[p])}function _wppaDoAutocol(p,a){if(!wppaAutoColumnWidth[p])return!0;var e;e=wppaGetContainerWidth(p),wppaConsoleLog("Doing autocol "+p+" "+a,"force"),wppaColWidth[p]=e,0==wppaResponseSpeed?jQuery(".wppa-container-"+p).css({width:e}):jQuery(".wppa-container-"+p).stop().animate({width:e},wppaResponseSpeed),wppaRenderModal&&(jQuery(".ui-dialog").css("width",e),jQuery(".ui-dialog").attr("height","auto")),wppaCoverImageResponsive[p]||(0==wppaResponseSpeed?(jQuery(".wppa-asym-text-frame-"+p).css({width:e-wppaTextFrameDelta}),jQuery(".wppa-cover-box-"+p).css({width:e})):(jQuery(".wppa-asym-text-frame-"+p).stop().animate({width:e-wppaTextFrameDelta},wppaResponseSpeed),jQuery(".wppa-cover-box-"+p).stop().animate({width:e},wppaResponseSpeed)));var t,o=jQuery(".wppa-cover-box-mcr-"+p);if(1<o.length){var r=parseInt((e+8)/(wppaMaxCoverWidth+8))+1,s=r-1;t=parseInt((e+8)/r-8);for(var i=0;i<o.length;){switch(i%r){case 0:jQuery(o[i]).css({marginLeft:"0px",clear:"both",float:"left"});break;case s:jQuery(o[i]).css({marginLeft:"8px",clear:"none",float:"right"});break;default:jQuery(o[i]).css({marginLeft:"8px",clear:"none",float:"left"})}i++}wppaCoverImageResponsive[p]||jQuery(".wppa-asym-text-frame-mcr-"+p).stop().animate({width:t-wppaTextFrameDelta},wppaResponseSpeed),jQuery(".wppa-cover-box-mcr-"+p).stop().animate({width:t},wppaResponseSpeed)}else if(wppaCoverImageResponsive[p]);else{jQuery(".wppa-asym-text-frame-mcr-"+p).stop().animate({width:e-wppaTextFrameDelta},wppaResponseSpeed);jQuery(".wppa-cover-box-mcr-"+p).css({marginLeft:"0px",float:"left"})}if(wppaThumbSpaceAuto){var n=parseInt(jQuery(".thumbnail-frame-"+p).css("width"));if(n){var w=e-wppaThumbnailAreaDelta-7,l=parseInt(w/(n+wppaMinThumbSpace)),u=parseInt(.5+(w-l*n)/(l+1));jQuery("").css("marginLeft")!=u&&jQuery(".thumbnail-frame-"+p).css({marginLeft:u})}}jQuery(".thumbnail-frame-comalt-"+p).css("width",e-wppaThumbnailAreaDelta),jQuery(".wppa-com-alt-"+p).css("width",e-wppaThumbnailAreaDelta-wppaComAltSize-16);for(var c,d=1,y=jQuery("#wppa-mas-h-"+d+"-"+p).attr("data-height-perc");y;)c=y*(e-wppaThumbnailAreaDelta)/100,jQuery("#wppa-mas-h-"+d+"-"+p).css("height",c),d++,y=jQuery("#wppa-mas-h-"+d+"-"+p).attr("data-height-perc");return wppaSetMasHorFrameWidthsForIeAndChrome(p),wppaFormatSlide(p),jQuery("#audio-slide-"+p).css("width",e-wppaBoxDelta-6),jQuery(".wppa-comment-textarea-"+p).css("width",.7*e),wppaFilmStripLength[p]=e-wppaFilmStripAreaDelta[p],jQuery("#filmwindow-"+p).css("width",wppaFilmStripLength[p]),_wppaAdjustFilmstrip(p),wppaIsMini[p]||void 0===_wppaSlides[p]||(wppaColWidth[p]<wppaMiniTreshold?(jQuery("#wppa-avg-rat-"+p).html(wppaAvgRat),jQuery("#wppa-my-rat-"+p).html(wppaMyRat),jQuery("#counter-"+p).html(_wppaCurIdx[p]+1+" / "+_wppaSlides[p].length)):(jQuery("#wppa-avg-rat-"+p).html(wppaAvgRating),jQuery("#wppa-my-rat-"+p).html(wppaMyRating),jQuery("#counter-"+p).html(wppaPhoto+" "+(_wppaCurIdx[p]+1)+" "+wppaOf+" "+_wppaSlides[p].length))),jQuery(".wppa-sphoto-"+p).css("width",e),jQuery(".wppa-simg-"+p).css("width",e-2*wppaSlideBorderWidth),jQuery(".wppa-simg-"+p).css("height",""),jQuery(".wppa-mphoto-"+p).css("width",e+10),jQuery(".wppa-mimg-"+p).css("width",e),jQuery(".wppa-mimg-"+p).css("height",""),0<wppaSearchBoxSelItems[p]&&(e/wppaSearchBoxSelItems[p]<125?jQuery(".wppa-searchsel-item-"+p).css("width","100%"):jQuery(".wppa-searchsel-item-"+p).css("width",100/wppaSearchBoxSelItems[p]+"%")),jQuery(".wppa-upload-album-"+p).css("maxWidth",.6*e),!0}function wppaSetMasHorFrameWidthsForIeAndChrome(p){for(var a=jQuery(".wppa-mas-h-"+p),e=wppaMinThumbSpace,t=0;t<a.length;t++){var o=wppaGetChildI(a[t]);if(o){if("IMG"==o.nodeName&&!o.complete)return void setTimeout("wppaSetMasHorFrameWidthsForIeAndChrome( "+p+" )",400);var r=o.naturalWidth/o.naturalHeight*o.height+e;jQuery(a[t]).css({width:r})}}}function wppaGetChildI(p){var a,e=p.childNodes;for(a=0;a<e.length;a++){var t=e[a];if(t.id&&"i-"==t.id.substr(0,2))return t;var o=wppaGetChildI(t);if(o)return o}return!1}jQuery(document).ready(function(){wppaDoInit()}),jQuery(document).ready(function(){jQuery(window).on("DOMContentLoaded load resize scroll",wppaSizeAutoDiv)}),jQuery(document).ready(function(p){if(wppaAllowAjax&&jQuery.ajax&&(wppaCanAjaxRender=!0),void 0!==history.pushState){for(var a=1;a<=wppaMaxOccur;)wppaStartHtml[a]=jQuery("#wppa-container-"+a).html(),a++;wppaCanPushState=!0}});var wppaFotomotoLoaded=!1,wppaFotomotoToolbarIds=[];function fotomoto_loaded(){wppaFotomotoLoaded=!0}function wppaFotomotoToolbar(p,a){if(!(wppaColWidth[p]>=wppaFotomotoMinWidth))return jQuery("#wppa-fotomoto-container-"+p).css("display","none"),void jQuery("#wppa-fotomoto-checkout-"+p).css("display","none");jQuery("#wppa-fotomoto-container-"+p).css("display","inline"),jQuery("#wppa-fotomoto-checkout-"+p).css("display","inline"),wppaFotomoto&&document.getElementById("wppa-fotomoto-container-"+p)&&(wppaFotomotoLoaded?(FOTOMOTO.API.checkinImage(a),wppaFotomotoToolbarIds[p]=FOTOMOTO.API.showToolbar("wppa-fotomoto-container-"+p,a)):(setTimeout("wppaFotomotoToolbar( "+p+',"'+a+'" )',200),wppaConsoleLog("Waiting for Fotomoto")))}function wppaFotomotoHide(p){jQuery("#wppa-fotomoto-container-"+p).css("display","none"),jQuery("#wppa-fotomoto-checkout-"+p).css("display","none")}function wppaStringContainsForbiddenChars(p){for(var a=["?","&","#","/",'"',"'"],e=0;e<a.length;){if(-1!=p.indexOf(a[e]))return!0;e++}return!1}function wppaPushStateSlide(p,a,e){if(!wppaIsMini[p]&&wppaCanPushState&&wppaUpdateAddressLine&&""!=e)try{history.pushState({page:wppaHis,occur:p,type:"slide",slide:a},"---",e),wppaConsoleLog("Slide history stack updated")}catch(p){wppaConsoleLog("Slide history stack update failed")}}function wppaRepairScriptTags(p){if(void 0===p)return"";for(;-1!=p.indexOf("[script");)p=p.replace("[script","<script");for(;-1!=p.indexOf("[/script");)p=p.replace("[/script","</script");return p}function wppaRepairBrTags(p){return void 0===p?"":p.replace("[br /]","<br />").replace("[a","<a").replace("&quot;",'"').replace('"]','">').replace("[/a]","</a>")}function wppaTrimAlt(p){return void 0===p?"":13<p.length?p.substr(0,10)+"...":p}window.onpopstate=function(p){var a=0;if(wppaCanPushState){if(p.state)switch(a=p.state.occur,p.state.type){case"html":jQuery("#wppa-container-"+a).html(p.state.html);break;case"slide":_wppaGoto(a,p.state.slide)}else if(wppaUpdateAddressLine){if(a=wppaFirstOccur,jQuery("#wppa-container-"+a).html(wppaStartHtml[a]),(wppaFirstOccur=0)==a){var e=document.location.href.split("&wppa-occur=");a=parseInt(e[1])}e=document.location.href.split("&wppa-photo=");var t=parseInt(e[1]);if(0<t){for(var o=0;o<_wppaId[a].length&&_wppaId[a][o]!=t;)o++;o<_wppaId[a].length&&_wppaGoto(a,o)}}document.getElementById("theslide0-"+a)&&_wppaStop(a)}"undefined"!=typeof wppaQRUpdate&&wppaQRUpdate(document.location.href)};var wppaFbInitBusy=!1;function wppaFbInit(){wppaFbInitBusy?wppaConsoleLog("Fb Init busy"):"undefined"!=typeof FB?(wppaFbInitBusy=!0,setTimeout("_wppaFbInit()",10)):(wppaConsoleLog("Fb wait"),setTimeout("wppaFbInit()",200))}function _wppaFbInit(){FB.init({status:!0,xfbml:!0}),wppaFbInitBusy=!1}function wppaInsertAtCursor(p,a){if(document.selection)p.focus(),sel=document.selection.createRange(),sel.text=a;else if(p.selectionStart||"0"==p.selectionStart){var e=p.selectionStart,t=p.selectionEnd;p.value=p.value.substring(0,e)+a+p.value.substring(t,p.value.length),p.selectionStart=e+a.length,p.selectionEnd=e+a.length}else p.value+=a}function wppaGeoInit(p,a,e){var t=new google.maps.LatLng(a,e),o={disableDefaultUI:!1,panControl:!1,zoomControl:!0,mapTypeControl:!0,scaleControl:!0,streetViewControl:!0,overviewMapControl:!0,zoom:wppaGeoZoom,center:t},r=new google.maps.Map(document.getElementById("map-canvas-"+p),o),s=new google.maps.Marker({position:t,map:r,title:""});google.maps.event.addListener(r,"center_changed",function(){window.setTimeout(function(){r.panTo(s.getPosition())},1e3)})}function wppaEncode(p){var a;if(void 0!==p){var e=(a=(a=String(p).replace(/#/g,"||HASH||")).replace(/&/g,"||AMP||")).split("+"),t=0;for(a="";t<e.length;)a+=e[t],++t<e.length&&(a+="||PLUS||");return a}}function wppaUrlToId(p){var a=p.split("/wppa/");return 1==a.length&&(a=p.split("/upload/")),1==a.length?0:a=(a=(a=(a=(a=(a=(a=a[1]).split("."))[0].replace("/","")).replace("/","")).replace("/","")).replace("/","")).replace("/","")}function wppaSuperSearchSelect(p,a){jQuery("#wppa-ss-albumopt-"+p).css("display","none"),jQuery("#wppa-ss-albumcat-"+p).css("display","none"),jQuery("#wppa-ss-albumname-"+p).css("display","none"),jQuery("#wppa-ss-albumtext-"+p).css("display","none"),jQuery("#wppa-ss-photoopt-"+p).css("display","none"),jQuery("#wppa-ss-photoname-"+p).css("display","none"),jQuery("#wppa-ss-photoowner-"+p).css("display","none"),jQuery("#wppa-ss-phototag-"+p).css("display","none"),jQuery("#wppa-ss-phototext-"+p).css("display","none"),jQuery("#wppa-ss-photoexif-"+p).css("display","none"),jQuery("#wppa-ss-photoiptc-"+p).css("display","none"),jQuery("#wppa-ss-exifopts-"+p).css("display","none"),jQuery("#wppa-ss-iptcopts-"+p).css("display","none"),jQuery("#wppa-ss-spinner-"+p).css("display","none"),jQuery("#wppa-ss-button-"+p).css("display","none");var e=jQuery("#wppa-ss-pa-"+p).val(),t="",o="",r="";switch(e){case"a":switch(jQuery("#wppa-ss-albumopt-"+p).css("display",""),t=jQuery("#wppa-ss-albumopt-"+p).val()){case"c":jQuery("#wppa-ss-albumcat-"+p).css("display","");var s=jQuery(".wppa-ss-albumcat-"+p);for(r="",i=0;i<s.length;i++)"selected"==jQuery(s[i]).attr("selected")&&(r+="."+jQuery(s[i]).val());""!=(r=r.substr(1))&&jQuery("#wppa-ss-button-"+p).css("display","");break;case"n":jQuery("#wppa-ss-albumname-"+p).css("display",""),null!=(r=jQuery("#wppa-ss-albumname-"+p).val())&&jQuery("#wppa-ss-button-"+p).css("display","");break;case"t":jQuery("#wppa-ss-albumtext-"+p).css("display","");s=jQuery(".wppa-ss-albumtext-"+p);for(r="",i=0;i<s.length;i++)"selected"==jQuery(s[i]).attr("selected")&&(r+="."+jQuery(s[i]).val());""!=(r=r.substr(1))&&jQuery("#wppa-ss-button-"+p).css("display","")}break;case"p":switch(jQuery("#wppa-ss-photoopt-"+p).css("display",""),t=jQuery("#wppa-ss-photoopt-"+p).val()){case"n":jQuery("#wppa-ss-photoname-"+p).css("display",""),null!=(r=jQuery("#wppa-ss-photoname-"+p).val())&&jQuery("#wppa-ss-button-"+p).css("display","");break;case"o":jQuery("#wppa-ss-photoowner-"+p).css("display",""),null!=(r=jQuery("#wppa-ss-photoowner-"+p).val())&&jQuery("#wppa-ss-button-"+p).css("display","");break;case"g":jQuery("#wppa-ss-phototag-"+p).css("display","");s=jQuery(".wppa-ss-phototag-"+p);for(r="",i=0;i<s.length;i++)"selected"==jQuery(s[i]).attr("selected")&&(r+="."+jQuery(s[i]).val());""!=(r=r.substr(1))&&jQuery("#wppa-ss-button-"+p).css("display","");break;case"t":jQuery("#wppa-ss-phototext-"+p).css("display","");var i;s=jQuery(".wppa-ss-phototext-"+p);for(r="",i=0;i<s.length;i++)"selected"==jQuery(s[i]).attr("selected")&&(r+="."+jQuery(s[i]).val());""!=(r=r.substr(1))&&jQuery("#wppa-ss-button-"+p).css("display","");break;case"i":jQuery("#wppa-ss-photoiptc-"+p).css("display",""),(o=jQuery("#wppa-ss-photoiptc-"+p).val())&&(2<o.length&&(o=o.replace("#","H")),""!=o&&(jQuery("#wppa-ss-iptcopts-"+p).css("display",""),wppaLastIptc!=o?(wppaAjaxGetSsIptcList(p,o,"wppa-ss-iptcopts-"+p),wppaLastIptc=o):null!=(r=jQuery("#wppa-ss-iptcopts-"+p).val())&&""!=r&&jQuery("#wppa-ss-button-"+p).css("display","")));break;case"e":jQuery("#wppa-ss-photoexif-"+p).css("display",""),(o=jQuery("#wppa-ss-photoexif-"+p).val())&&(2<o.length&&(o=o.replace("#","H")),""!=o&&(jQuery("#wppa-ss-exifopts-"+p).css("display",""),wppaLastExif!=o?(wppaAjaxGetSsExifList(p,o,"wppa-ss-exifopts-"+p),wppaLastExif=o):null!=(r=jQuery("#wppa-ss-exifopts-"+p).val())&&""!=r&&jQuery("#wppa-ss-button-"+p).css("display","")))}}if(a){var n=jQuery("#wppa-ss-pageurl-"+p).val();-1==n.indexOf("?")?n+="?":n+="&",n+="occur=1&wppa-supersearch="+e+","+t+","+o+","+r,document.location.href=n}}function wppaAjaxGetSsIptcList(t,p,o){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=getssiptclist&tag="+p+"&moccur="+t,async:!0,type:"GET",timeout:1e4,beforeSend:function(p){jQuery("#wppa-ss-spinner-"+t).css("display","")},success:function(p,a,e){jQuery("#"+o).html(p),jQuery("#wppa-ss-iptcopts-"+t).css("display",""),wppaSuperSearchSelect(t),setTimeout('wppaSetIptcExifSize( ".wppa-iptclist-'+t+'", "#'+o+'" )',10)},error:function(p,a,e){wppaConsoleLog("wppaAjaxGetSsIptcList failed. Error = "+e+", status = "+a,"force")},complete:function(p,a,e){jQuery("#wppa-ss-spinner-"+t).css("display","none")}})}function wppaAjaxGetSsExifList(t,p,o){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=getssexiflist&tag="+p+"&moccur="+t,async:!0,type:"GET",timeout:1e4,beforeSend:function(p){jQuery("#wppa-ss-spinner-"+t).css("display","")},success:function(p,a,e){jQuery("#"+o).html(p),jQuery("#wppa-ss-exifopts-"+t).css("display",""),wppaSuperSearchSelect(t),setTimeout('wppaSetIptcExifSize( ".wppa-exiflist-'+t+'", "#'+o+'" )',10)},error:function(p,a,e){wppaConsoleLog("wppaAjaxGetSsExifList failed. Error = "+e+", status = "+a,"force")},complete:function(p,a,e){jQuery("#wppa-ss-spinner-"+t).css("display","none")}})}function wppaSetIptcExifSize(p,a){var e=jQuery(p).length;6<e&&(e=6),e<2&&(e=2),jQuery(a).attr("size",e)}function wppaUpdateSearchRoot(p,a){for(var e=jQuery(".wppa-search-root"),t=0;t<e.length;)jQuery(e[t]).html(p),t++;for(e=jQuery(".wppa-rootbox"),t=0;t<e.length;)a?(jQuery(e[t]).prop("checked",!1),jQuery(e[t]).prop("disabled",!1)):(jQuery(e[t]).prop("checked",!0),jQuery(e[t]).prop("disabled",!0)),t++;for(e=jQuery(".wppa-search-root-id"),t=0;t<e.length;)jQuery(e[t]).val(a),t++}function wppaSubboxChange(p){jQuery(p).prop("checked")&&jQuery(".wppa-rootbox").each(function(p){jQuery(this).prop("checked",!0)})}function wppaClearSubsearch(){for(var p=jQuery(".wppa-display-searchstring"),a=0;a<p.length;)jQuery(p[a]).html(""),a++;for(p=jQuery(".wppa-search-sub-box"),a=0;a<p.length;)jQuery(p[a]).attr("disabled","disabled"),a++}function wppaEnableSubsearch(){for(var p=jQuery(".wppa-search-sub-box"),a=0;a<p.length;)jQuery(p[a]).removeAttr("disabled"),a++}function wppaDisplaySelectedFiles(p){for(var a=jQuery("#"+p),e=0,t="";e<a[0].files.length;)t+=a[0].files[e].name+" ",e++;jQuery("#"+p+"-display").val(t)}function wppaIsEmpty(p){return null==p||(void 0===p||(""==p||(0==p||(0==p||void 0))))}function wppaGetUploadOptions(yalb,mocc,where,onComplete){var options={beforeSend:function(){jQuery("#progress-"+yalb+"-"+mocc).show(),jQuery("#bar-"+yalb+"-"+mocc).width("0%"),jQuery("#message-"+yalb+"-"+mocc).html(""),jQuery("#percent-"+yalb+"-"+mocc).html("")},uploadProgress:function(p,a,e,t){jQuery("#bar-"+yalb+"-"+mocc).css("backgroundColor","#7F7"),jQuery("#bar-"+yalb+"-"+mocc).width(t+"%"),t<95?jQuery("#percent-"+yalb+"-"+mocc).html(t+"%"):jQuery("#percent-"+yalb+"-"+mocc).html(wppaProcessing)},success:function(){jQuery("#bar-"+yalb+"-"+mocc).width("100%"),jQuery("#percent-"+yalb+"-"+mocc).html(wppaDone),jQuery(".wppa-upload-button").val(wppaUploadButtonText)},complete:function(response){-1!=response.responseText.indexOf(wppaUploadFailed)?(jQuery("#bar-"+yalb+"-"+mocc).css("backgroundColor","#F77"),jQuery("#percent-"+yalb+"-"+mocc).html(wppaUploadFailed),jQuery("#message-"+yalb+"-"+mocc).html('<span style="font-size: 10px;" >'+response.responseText+"</span>")):(jQuery("#message-"+yalb+"-"+mocc).html('<span style="font-size: 10px;" >'+response.responseText+"</span>"),"thumb"!=where&&"cover"!=where||eval(onComplete))},error:function(){jQuery("#message-"+yalb+"-"+mocc).html('<span style="color: red;" >'+wppaServerError+"</span>"),jQuery("#bar-"+yalb+"-"+mocc).css("backgroundColor","#F77"),jQuery("#percent-"+yalb+"-"+mocc).html(wppaUploadFailed)}};return options}wppaConsoleLog("wppa.js version "+wppaJsVersion+" loaded.","force");
1
+ var wppaDebug,wppaAnimationSpeed,wppaImageDirectory,wppaJsVersion="7.1.00",wppaVersion="0",wppaIsIe=!1,wppaUseSvg=!0,wppaFullValign=[],wppaFullHalign=[],wppaFullFrameDelta=[];if(!wppaAutoColumnWidth)var wppaAutoColumnWidth=[];if(!wppaAutoColumnFrac)var wppaAutoColumnFrac=[];var wppaThumbnailAreaDelta,wppaSlideShow,wppaPhoto,wppaOf,wppaNextPhoto,wppaPreviousPhoto,wppaNextP,wppaPrevP,wppaAvgRating,wppaMyRating,wppaAvgRat,wppaMyRat,wppaDislikeMsg,wppaPleaseName,wppaPleaseEmail,wppaPleaseComment,wppaSlideShowTimeOut=2500,wppaFadeInAfterFadeOut=!1,wppaTextFrameDelta=0,wppaBoxDelta=0,wppaPreambule=[],wppaHideWhenEmpty=!1,wppaThumbnailPitch=[],wppaFilmStripLength=[],wppaFilmStripMargin=[],wppaFilmStripAreaDelta=[],wppaFilmShowGlue=!1,wppaIsMini=[],wppaPortraitOnly=[],wppaMiniTreshold=300,wppaStart="Start",wppaStop="Stop",wppaRatingOnce=!0,wppaBGcolorNumbar="transparent",wppaBcolorNumbar="transparent",wppaBGcolorNumbarActive="transparent",wppaBcolorNumbarActive="transparent",wppaFontFamilyNumbar="",wppaFontSizeNumbar="",wppaFontColorNumbar="",wppaFontWeightNumbar="",wppaFontFamilyNumbarActive="",wppaFontSizeNumbarActive="",wppaFontColorNumbarActive="",wppaFontWeightNumbarActive="",wppaNumbarMax="10",wppaAjaxUrl="",wppaLang="",wppaNextOnCallback=!1,wppaStarOpacity=.2,wppaLightBox=[],wppaEmailRequired="required",wppaSlideBorderWidth=0,wppaSlideInitRunning=[],wppaAnimationType="fadeover",wppaSlidePause=[],wppaSlideBlank=[],wppaRatingMax=5,wppaRatingDisplayType="graphic",wppaRatingPrec=2,wppaFilmPageSize=[],wppaAspectRatio=[],wppaFullSize=[],wppaStretch=!1,wppaThumbSpaceAuto=!1,wppaMinThumbSpace=4,wppaMagnifierCursor="",wppaArtMonkyLink="none",wppaAutoOpenComments=!1,wppaUpdateAddressLine=!1,wppaFilmThumbTitle="",wppaClickToView="",wppaUploadUrl="",wppaVoteForMe="",wppaVotedForMe="",wppaSlideSwipe=!0,wppaLightboxSingle=[],wppaMaxCoverWidth=300,wppaDownLoad="Download",wppaSiteUrl="",wppaWppaUrl="",wppaIncludeUrl="",wppaSlideToFullpopup=!1,wppaComAltSize=75,wppaBumpViewCount=!0,wppaBumpClickCount=!1,wppaFotomoto=!1,wppaArtMonkeyButton=!0,wppaShortQargs=!1,wppaOvlHires=!1,wppaMasonryCols=[],wppaVideoPlaying=[],wppaAudioPlaying=[],wppaSlideVideoStart=!1,wppaSlideAudioStart=!1,wppaAudioHeight=28,wppaHis=0,wppaStartHtml=[],wppaCanAjaxRender=!1,wppaCanPushState=!1,wppaAllowAjax=!0,wppaMaxOccur=0,wppaFirstOccur=0,wppaUsePhotoNamesInUrls=!1,wppaShareHideWhenRunning=!1,wppaCommentRequiredAfterVote=!0,wppaTopMoc=0;if(!wppaColWidth)var wppaColWidth=[];var wppaModalQuitImg,_wppaTextDelay,wppaOvlUrls,wppaOvlTitles,wppaOvlAlts,wppaOvlIsSingle,wppaOvlVideoHtmls,wppaOvlAudioHtmls,wppaOvlVideoNaturalWidths,wppaOvlVideoNaturalHeights,wppaFotomotoHideWhenRunning=!1,wppaFotomotoMinWidth=400,wppaPhotoView=[],wppaBackgroundColorImage="",wppaPopupLinkType="",wppaPopupOnclick=[],wppaThumbTargetBlank=!1,wppaRel="rel",wppaEditPhotoWidth="960",wppaThemeStyles="",wppaStickyHeaderHeight=0,wppaRenderModal=!1,wppaModalBgColor="#ffffff",wppaBoxRadius=0,wppaUploadEdit="none",wppaPageArg="",wppaSlideshowNavigationType="icons",wppaCoverImageResponsive=[],wppaSearchBoxSelItems=[],wppaSlideWrap=[],wppaHideRightClick=!1,wppaProcessing="Processing...",wppaDone="Done!",wppaUploadFailed="Upload failed",wppaServerError="Server error",wppaGeoZoom=10,wppaLazyLoad=!0,wppaThumbAreaMaxFrac=1,wppaNiceScroll=!1,wppaIconSizeNormal="default",wppaIconSizeSlide=48,wppaIconSizeStars=24,wppaResponseSpeed=500,_wppaId=[],_wppaAvg=[],_wppaDisc=[],_wppaMyr=[],_wppaVRU=[],_wppaLinkUrl=[],_wppaLinkTitle=[],_wppaLinkTarget=[],_wppaCommentHtml=[],_wppaIptcHtml=[],_wppaExifHtml=[],_wppaToTheSame=!1,_wppaSlides=[],_wppaNames=[],_wppaFullNames=[],_wppaDsc=[],_wppaOgDsc=[],_wppaCurIdx=[],_wppaNxtIdx=[],_wppaTimeOut=[],_wppaSSRuns=[],_wppaFg=[],_wppaTP=[],_wppaIsBusy=[],_wppaFirst=[],_wppaVoteInProgress=!1,_wppaUrl=[],_wppaSkipRated=[],_wppaLbTitle=[],_wppaStateCount=0,_wppaDidGoto=[],_wppaShareUrl=[],_wppaShareHtml=[],_wppaFilmNoMove=[],_wppaHiresUrl=[],_wppaIsVideo=[],_wppaVideoHtml=[],_wppaAudioHtml=[],_wppaVideoNatWidth=[],_wppaVideoNatHeight=[],_wppaWaitTexts=[],_wppaImageAlt=[],_wppaSavedWidth=0,_wppaSavedHeight=0,__wppaOverruleRun=!1,wppaOvlIdx=0,wppaOvlFirst=!0,wppaOvlKbHandler="",wppaOvlSizeHandler="",wppaOvlPadTop=5,wppaOvlRunning=!1,wppaOvlModeInitial="normal",wppaOvlVideoPlaying=!1,wppaOvlAudioPlaying=!1,wppaOvlShowLegenda=!0,wppaOvlShowStartStop=!0,wppaOvlRadius=0,wppaOvlBorderWidth=16,wppaOvlOpen=!1,wppaOvlTxtHeight=36,wppaOvlOpacity=.8,wppaOvlOnclickType="none",wppaOvlTheme="black",wppaOvlAnimSpeed=300,wppaOvlSlideSpeed=3e3,wppaVer4WindowWidth=800,wppaVer4WindowHeight=600,wppaOvlFontFamily="Helvetica",wppaOvlFontSize="10",wppaOvlFontColor="",wppaOvlFontWeight="bold",wppaOvlLineHeight="12",wppaOvlShowCounter=!0,wppaOvlIsVideo=!1,wppaShowLegenda="",wppaOvlFsPhotoId=0,wppaPhotoId=0,wppaOvlVideoStart=!1,wppaOvlAudioStart=!1,wppaLastIptc="",wppaLastExif="",wppaIsMobile=!1,wppaSvgFillcolor="gray",wppaSvgBgcolor="transparent",wppaSvgCornerStyle="light";jQuery(document).ready(function(){wppaDoInit()});function wppaDoInit(){_wppaTextDelay=wppaAnimationSpeed,wppaFadeInAfterFadeOut&&(_wppaTextDelay*=2),jQuery(".wppa-ajax-spin").stop().fadeOut(),jQuery(".wppa-ovl-spin").hide(),setTimeout(function(){for(var a=1;a<wppaTopMoc;)jQuery("#ubb-"+a+"-l")&&(wppaUbb(a,"l","hide"),wppaUbb(a,"r","hide")),a++},3e3),jQuery(window).on("DOMContentLoaded load resize orientationchange",wppaDoAllAutocols),jQuery(window).on("DOMContentLoaded load resize scroll",wppaSizeThumbArea),jQuery(window).on("DOMContentLoaded load resize scroll",wppaMakeLazyVisible),jQuery(window).trigger("resize"),wppaProtect()}jQuery(document).ready(function(){jQuery(window).on("DOMContentLoaded load resize scroll",wppaSizeAutoDiv)});function wppaSizeAutoDiv(){jQuery(".wppa-autodiv").each(function(){var a=jQuery(window).height(),b=jQuery(this).attr("data-max-height");jQuery(this).css({maxHeight:a*b})})}function wppaDoAllAutocols(a){for("number"!=typeof a&&(a=1),wppaConsoleLog("Doing wppaDoAllAutocols "+a),mocc=1;mocc<=wppaTopMoc;mocc++)wppaAutoColumnWidth[mocc]&&_wppaDoAutocol(mocc,a);a++;var b=wppaWindowWidth(),c=wppaWindowHeight();b!=_wppaSavedWidth&&c!=_wppaSavedHeight&&setTimeout(function(){wppaDoAllAutocols(a)},100),_wppaSavedWidth=b,_wppaSavedHeight=c}function wppaProtect(){wppaHideRightClick&&(jQuery("img").bind("contextmenu",function(){return!1}),jQuery("video").bind("contextmenu",function(){return!1}))}jQuery(document).ready(function(){if(wppaAllowAjax&&jQuery.ajax&&(wppaCanAjaxRender=!0),"undefined"!=typeof history.pushState){for(var a=1;a<=wppaMaxOccur;)wppaStartHtml[a]=jQuery("#wppa-container-"+a).html(),a++;wppaCanPushState=!0}});function wppaUpdateLightboxes(){"function"==typeof wppaInitOverlay&&wppaInitOverlay(),"undefined"!=typeof myLightbox&&"function"==typeof myLightbox.updateImageList&&myLightbox.updateImageList(),jQuery().prettyPhoto&&jQuery("a[rel^='prettyPhoto']").prettyPhoto({deeplinking:!1})}function wppaStopVideo(a){var b,c,d=[];for(d[1]="wppa-overlay-img",d[2]="theimg0-"+a,d[3]="theimg1-"+a,c=0;3>c;)c++,(1!=c||0==a)&&(b=document.getElementById(d[c]),b&&"function"==typeof b.pause&&(b.pause(),wppaConsoleLog("Video "+d[c]+" paused","force")))}function wppaStopAudio(a){if("number"==typeof a)jQuery("#audio-"+a).pause&&jQuery("#audio-"+a).pause();else{var b=jQuery("audio");if(0<b.length)for(var c=0;c<b.length;)"wppa"==jQuery(b[c]).attr("data-from")&&b[c].pause(),c++}}function wppaMakeFullsizeUrl(a){var b,c;a=a.replace("/thumbs/","/"),b=a.split("//"),b[1]?(c=b[1].split("/"),a=b[0]+"//"):(c=b[0].split("/"),a="");for(var d=0;d<c.length;){var e=c[d],f=e.split("_");"w"!=f[0]&&(0!=d&&(a+="/"),a+=e),d++}return a}function wppaGetContainerWidth(a){var b=document.getElementById("wppa-container-"+a),c=0;if(!wppaAutoColumnWidth[a])return b.clientWidth;for(;0==c;)b=b.parentNode,c=jQuery(b).width();return parseInt(c*wppaAutoColumnFrac[a])}function _wppaDoAutocol(a,b){if(!wppaAutoColumnWidth[a])return!0;var c;c=wppaGetContainerWidth(a),wppaConsoleLog("Doing autocol "+a+" "+b,"force"),wppaColWidth[a]=c,jQuery(".wppa-container-"+a).stop().animate({width:c},wppaResponseSpeed),wppaRenderModal&&(jQuery(".ui-dialog").css("width",c),jQuery(".ui-dialog").attr("height","auto")),wppaCoverImageResponsive[a]||(jQuery(".wppa-asym-text-frame-"+a).stop().animate({width:c-wppaTextFrameDelta},wppaResponseSpeed),jQuery(".wppa-cover-box-"+a).stop().animate({width:c},wppaResponseSpeed));var d,e=jQuery(".wppa-cover-box-mcr-"+a);if(1<e.length){var f=parseInt((c+8)/(wppaMaxCoverWidth+8))+1;d=parseInt((c+8)/f-8);for(var g,h=0;h<e.length;)g=h%f,0==g?jQuery(e[h]).css({marginLeft:"0px",clear:"both",float:"left"}):g===f-1?jQuery(e[h]).css({marginLeft:"8px",clear:"none",float:"right"}):jQuery(e[h]).css({marginLeft:"8px",clear:"none",float:"left"}),h++;wppaCoverImageResponsive[a]||jQuery(".wppa-asym-text-frame-mcr-"+a).stop().animate({width:d-wppaTextFrameDelta},wppaResponseSpeed),jQuery(".wppa-cover-box-mcr-"+a).stop().animate({width:d},wppaResponseSpeed)}else if(wppaCoverImageResponsive[a]);else{jQuery(".wppa-asym-text-frame-mcr-"+a).stop().animate({width:c-wppaTextFrameDelta},wppaResponseSpeed);jQuery(".wppa-cover-box-mcr-"+a).css({marginLeft:"0px",float:"left"})}if(wppaThumbSpaceAuto){var i=parseInt(jQuery(".thumbnail-frame-"+a).css("width"));if(i){var j=c-wppaThumbnailAreaDelta-7,k=Math.max(1,parseInt(j/(i+wppaMinThumbSpace))),l=parseInt(.5+(j-k*i)/(k+1));jQuery(".thumbnail-frame-"+a).css({marginLeft:l})}}jQuery(".thumbnail-frame-comalt-"+a).css("width",c-wppaThumbnailAreaDelta),jQuery(".wppa-com-alt-"+a).css("width",c-wppaThumbnailAreaDelta-wppaComAltSize-16);for(var m,n=1,o=jQuery("#wppa-mas-h-"+n+"-"+a).attr("data-height-perc");o;)m=o*(c-wppaThumbnailAreaDelta)/100,jQuery("#wppa-mas-h-"+n+"-"+a).css("height",m),n++,o=jQuery("#wppa-mas-h-"+n+"-"+a).attr("data-height-perc");return wppaSetMasHorFrameWidthsForIeAndChrome(a),wppaFormatSlide(a),jQuery("#audio-slide-"+a).css("width",c-wppaBoxDelta-6),jQuery(".wppa-comment-textarea-"+a).css("width",.7*c),wppaFilmStripLength[a]=c-wppaFilmStripAreaDelta[a],jQuery("#filmwindow-"+a).css("width",wppaFilmStripLength[a]),_wppaAdjustFilmstrip(a),wppaIsMini[a]||"undefined"==typeof _wppaSlides[a]||(wppaColWidth[a]<wppaMiniTreshold?(jQuery("#wppa-avg-rat-"+a).html(wppaAvgRat),jQuery("#wppa-my-rat-"+a).html(wppaMyRat),jQuery("#counter-"+a).html(_wppaCurIdx[a]+1+" / "+_wppaSlides[a].length)):(jQuery("#wppa-avg-rat-"+a).html(wppaAvgRating),jQuery("#wppa-my-rat-"+a).html(wppaMyRating),jQuery("#counter-"+a).html(wppaPhoto+" "+(_wppaCurIdx[a]+1)+" "+wppaOf+" "+_wppaSlides[a].length))),jQuery(".wppa-sphoto-"+a).css("width",c),jQuery(".wppa-simg-"+a).css("width",c-2*wppaSlideBorderWidth),jQuery(".wppa-simg-"+a).css("height",""),jQuery(".wppa-mphoto-"+a).css("width",c+10),jQuery(".wppa-mimg-"+a).css("width",c),jQuery(".wppa-mimg-"+a).css("height",""),0<wppaSearchBoxSelItems[a]&&(125>c/wppaSearchBoxSelItems[a]?jQuery(".wppa-searchsel-item-"+a).css("width","100%"):jQuery(".wppa-searchsel-item-"+a).css("width",100/wppaSearchBoxSelItems[a]+"%")),jQuery(".wppa-upload-album-"+a).css("maxWidth",.6*c),!0}function wppaSetMasHorFrameWidthsForIeAndChrome(a){for(var b,c=jQuery(".wppa-mas-h-"+a),d=0;d<c.length;d++)if(b=wppaGetChildI(c[d]),b){if("IMG"==b.nodeName&&!b.complete)return void setTimeout("wppaSetMasHorFrameWidthsForIeAndChrome( "+a+" )",400);var e=b.naturalWidth/b.naturalHeight*b.height+wppaMinThumbSpace;jQuery(c[d]).css({width:e})}}function wppaGetChildI(a){var b,c=a.childNodes;for(b=0;b<c.length;b++){var d=c[b];if(d.id&&"i-"==d.id.substr(0,2))return d;var e=wppaGetChildI(d);if(e)return e}return!1}var wppaFotomotoLoaded=!1,wppaFotomotoToolbarIds=[];function fotomoto_loaded(){wppaFotomotoLoaded=!0}function wppaFotomotoToolbar(a,b){if(wppaColWidth[a]>=wppaFotomotoMinWidth)jQuery("#wppa-fotomoto-container-"+a).css("display","inline"),jQuery("#wppa-fotomoto-checkout-"+a).css("display","inline");else return jQuery("#wppa-fotomoto-container-"+a).css("display","none"),void jQuery("#wppa-fotomoto-checkout-"+a).css("display","none");wppaFotomoto&&document.getElementById("wppa-fotomoto-container-"+a)&&(wppaFotomotoLoaded?(FOTOMOTO.API.checkinImage(b),wppaFotomotoToolbarIds[a]=FOTOMOTO.API.showToolbar("wppa-fotomoto-container-"+a,b)):(setTimeout("wppaFotomotoToolbar( "+a+",\""+b+"\" )",200),wppaConsoleLog("Waiting for Fotomoto")))}function wppaFotomotoHide(a){jQuery("#wppa-fotomoto-container-"+a).css("display","none"),jQuery("#wppa-fotomoto-checkout-"+a).css("display","none")}function wppaStringContainsForbiddenChars(a){for(var b=["?","&","#","/","\"","'"],c=0;c<b.length;){if(-1!=a.indexOf(b[c]))return!0;c++}return!1}window.onpopstate=function(a){var b=0;if(wppaCanPushState){if(a.state)switch(b=a.state.occur,a.state.type){case"html":jQuery("#wppa-container-"+b).html(a.state.html);break;case"slide":_wppaGoto(b,a.state.slide);}else if(wppaUpdateAddressLine){if(b=wppaFirstOccur,jQuery("#wppa-container-"+b).html(wppaStartHtml[b]),wppaFirstOccur=0,0==b){var c=document.location.href,d=c.split("&wppa-occur=");b=parseInt(d[1])}var c=document.location.href,d=c.split("&wppa-photo="),e=parseInt(d[1]);if(0<e){for(var f=0;f<_wppaId[b].length&&_wppaId[b][f]!=e;)f++;f<_wppaId[b].length&&_wppaGoto(b,f)}}document.getElementById("theslide0-"+b)&&_wppaStop(b)}"undefined"!=typeof wppaQRUpdate&&wppaQRUpdate(document.location.href)};function wppaPushStateSlide(a,b,c){if(!wppaIsMini[a]&&wppaCanPushState&&wppaUpdateAddressLine&&""!=c)try{history.pushState({page:wppaHis,occur:a,type:"slide",slide:b},"---",c),wppaConsoleLog("Slide history stack updated")}catch(a){wppaConsoleLog("Slide history stack update failed")}}function wppaRepairScriptTags(a){if("undefined"==typeof a)return"";for(;-1!=a.indexOf("[script");)a=a.replace("[script","<script");for(;-1!=a.indexOf("[/script");)a=a.replace("[/script","</script");return a}function wppaRepairBrTags(a){var b;return"undefined"==typeof a?"":(b=a,b=b.replace("[br /]","<br />"),b=b.replace("[a","<a"),b=b.replace("&quot;","\""),b=b.replace("\"]","\">"),b=b.replace("[/a]","</a>"),b)}function wppaTrimAlt(a){var b;return"undefined"==typeof a?"":(b=13<a.length?a.substr(0,10)+"...":a,b)}var wppaFbInitBusy=!1;function wppaFbInit(){wppaFbInitBusy?wppaConsoleLog("Fb Init busy"):"undefined"==typeof FB?(wppaConsoleLog("Fb wait"),setTimeout("wppaFbInit()",200)):(wppaFbInitBusy=!0,setTimeout("_wppaFbInit()",10))}function _wppaFbInit(){FB.init({status:!0,xfbml:!0}),wppaFbInitBusy=!1}function wppaInsertAtCursor(a,b){if(document.selection)a.focus(),sel=document.selection.createRange(),sel.text=b;else if(a.selectionStart||"0"==a.selectionStart){var c=a.selectionStart,d=a.selectionEnd;a.value=a.value.substring(0,c)+b+a.value.substring(d,a.value.length),a.selectionStart=c+b.length,a.selectionEnd=c+b.length}else a.value+=b}function wppaGeoInit(a,b,c){var d=new google.maps.LatLng(b,c),e=new google.maps.Map(document.getElementById("map-canvas-"+a),{disableDefaultUI:!1,panControl:!1,zoomControl:!0,mapTypeControl:!0,scaleControl:!0,streetViewControl:!0,overviewMapControl:!0,zoom:wppaGeoZoom,center:d}),f=new google.maps.Marker({position:d,map:e,title:""});google.maps.event.addListener(e,"center_changed",function(){window.setTimeout(function(){e.panTo(f.getPosition())},1e3)})}function wppaEncode(a){var b,c;if("undefined"!=typeof a){b=a+"",c=b.replace(/#/g,"||HASH||"),b=c,c=b.replace(/&/g,"||AMP||"),b=c;var d=b.split("+"),e=0;for(c="";e<d.length;)c+=d[e],e++,e<d.length&&(c+="||PLUS||");return c}}function wppaUrlToId(a){var b=a.split("/wppa/");return(1==b.length&&(b=a.split("/upload/")),1==b.length)?0:(b=b[1],b=b.split("."),b=b[0].replace("/",""),b=b.replace("/",""),b=b.replace("/",""),b=b.replace("/",""),b=b.replace("/",""),b)}function wppaSuperSearchSelect(a,b){jQuery("#wppa-ss-albumopt-"+a).css("display","none"),jQuery("#wppa-ss-albumcat-"+a).css("display","none"),jQuery("#wppa-ss-albumname-"+a).css("display","none"),jQuery("#wppa-ss-albumtext-"+a).css("display","none"),jQuery("#wppa-ss-photoopt-"+a).css("display","none"),jQuery("#wppa-ss-photoname-"+a).css("display","none"),jQuery("#wppa-ss-photoowner-"+a).css("display","none"),jQuery("#wppa-ss-phototag-"+a).css("display","none"),jQuery("#wppa-ss-phototext-"+a).css("display","none"),jQuery("#wppa-ss-photoexif-"+a).css("display","none"),jQuery("#wppa-ss-photoiptc-"+a).css("display","none"),jQuery("#wppa-ss-exifopts-"+a).css("display","none"),jQuery("#wppa-ss-iptcopts-"+a).css("display","none"),jQuery("#wppa-ss-spinner-"+a).css("display","none"),jQuery("#wppa-ss-button-"+a).css("display","none");var c=jQuery("#wppa-ss-pa-"+a).val(),d="",e="",f="";switch(c){case"a":switch(jQuery("#wppa-ss-albumopt-"+a).css("display",""),d=jQuery("#wppa-ss-albumopt-"+a).val(),d){case"c":jQuery("#wppa-ss-albumcat-"+a).css("display","");var g=jQuery(".wppa-ss-albumcat-"+a);f="";var h;for(h=0;h<g.length;h++)"selected"==jQuery(g[h]).attr("selected")&&(f+="."+jQuery(g[h]).val());f=f.substr(1),""!=f&&jQuery("#wppa-ss-button-"+a).css("display","");break;case"n":jQuery("#wppa-ss-albumname-"+a).css("display",""),f=jQuery("#wppa-ss-albumname-"+a).val(),null!=f&&jQuery("#wppa-ss-button-"+a).css("display","");break;case"t":jQuery("#wppa-ss-albumtext-"+a).css("display","");var g=jQuery(".wppa-ss-albumtext-"+a);f="";var h;for(h=0;h<g.length;h++)"selected"==jQuery(g[h]).attr("selected")&&(f+="."+jQuery(g[h]).val());f=f.substr(1),""!=f&&jQuery("#wppa-ss-button-"+a).css("display","");}break;case"p":switch(jQuery("#wppa-ss-photoopt-"+a).css("display",""),d=jQuery("#wppa-ss-photoopt-"+a).val(),d){case"n":jQuery("#wppa-ss-photoname-"+a).css("display",""),f=jQuery("#wppa-ss-photoname-"+a).val(),null!=f&&jQuery("#wppa-ss-button-"+a).css("display","");break;case"o":jQuery("#wppa-ss-photoowner-"+a).css("display",""),f=jQuery("#wppa-ss-photoowner-"+a).val(),null!=f&&jQuery("#wppa-ss-button-"+a).css("display","");break;case"g":jQuery("#wppa-ss-phototag-"+a).css("display","");var g=jQuery(".wppa-ss-phototag-"+a);f="";var h;for(h=0;h<g.length;h++)"selected"==jQuery(g[h]).attr("selected")&&(f+="."+jQuery(g[h]).val());f=f.substr(1),""!=f&&jQuery("#wppa-ss-button-"+a).css("display","");break;case"t":jQuery("#wppa-ss-phototext-"+a).css("display","");var g=jQuery(".wppa-ss-phototext-"+a);f="";var h;for(h=0;h<g.length;h++)"selected"==jQuery(g[h]).attr("selected")&&(f+="."+jQuery(g[h]).val());f=f.substr(1),""!=f&&jQuery("#wppa-ss-button-"+a).css("display","");break;case"i":jQuery("#wppa-ss-photoiptc-"+a).css("display",""),e=jQuery("#wppa-ss-photoiptc-"+a).val(),e&&(2<e.length&&(e=e.replace("#","H")),""!=e&&(jQuery("#wppa-ss-iptcopts-"+a).css("display",""),wppaLastIptc==e?(f=jQuery("#wppa-ss-iptcopts-"+a).val(),null!=f&&""!=f&&jQuery("#wppa-ss-button-"+a).css("display","")):(wppaAjaxGetSsIptcList(a,e,"wppa-ss-iptcopts-"+a),wppaLastIptc=e)));break;case"e":jQuery("#wppa-ss-photoexif-"+a).css("display",""),e=jQuery("#wppa-ss-photoexif-"+a).val(),e&&(2<e.length&&(e=e.replace("#","H")),""!=e&&(jQuery("#wppa-ss-exifopts-"+a).css("display",""),wppaLastExif==e?(f=jQuery("#wppa-ss-exifopts-"+a).val(),null!=f&&""!=f&&jQuery("#wppa-ss-button-"+a).css("display","")):(wppaAjaxGetSsExifList(a,e,"wppa-ss-exifopts-"+a),wppaLastExif=e)));}}if(b){var j=jQuery("#wppa-ss-pageurl-"+a).val();j+=-1==j.indexOf("?")?"?":"&",j+="occur=1&wppa-supersearch="+c+","+d+","+e+","+f,document.location.href=j}}function wppaAjaxGetSsIptcList(a,b,c){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=getssiptclist&tag="+b+"&moccur="+a,async:!0,type:"GET",timeout:1e4,beforeSend:function(){jQuery("#wppa-ss-spinner-"+a).css("display","")},success:function(b){jQuery("#"+c).html(b),jQuery("#wppa-ss-iptcopts-"+a).css("display",""),wppaSuperSearchSelect(a),setTimeout("wppaSetIptcExifSize( \".wppa-iptclist-"+a+"\", \"#"+c+"\" )",10)},error:function(a,b,c){wppaConsoleLog("wppaAjaxGetSsIptcList failed. Error = "+c+", status = "+b,"force")},complete:function(){jQuery("#wppa-ss-spinner-"+a).css("display","none")}})}function wppaAjaxGetSsExifList(a,b,c){jQuery.ajax({url:wppaAjaxUrl,data:"action=wppa&wppa-action=getssexiflist&tag="+b+"&moccur="+a,async:!0,type:"GET",timeout:1e4,beforeSend:function(){jQuery("#wppa-ss-spinner-"+a).css("display","")},success:function(b){jQuery("#"+c).html(b),jQuery("#wppa-ss-exifopts-"+a).css("display",""),wppaSuperSearchSelect(a),setTimeout("wppaSetIptcExifSize( \".wppa-exiflist-"+a+"\", \"#"+c+"\" )",10)},error:function(a,b,c){wppaConsoleLog("wppaAjaxGetSsExifList failed. Error = "+c+", status = "+b,"force")},complete:function(){jQuery("#wppa-ss-spinner-"+a).css("display","none")}})}function wppaSetIptcExifSize(a,b){var c=jQuery(a),d=c.length;6<d&&(d=6),2>d&&(d=2),jQuery(b).attr("size",d)}function wppaUpdateSearchRoot(a,b){for(var c=jQuery(".wppa-search-root"),d=0;d<c.length;)jQuery(c[d]).html(a),d++;for(c=jQuery(".wppa-rootbox"),d=0;d<c.length;)b?(jQuery(c[d]).prop("checked",!1),jQuery(c[d]).prop("disabled",!1)):(jQuery(c[d]).prop("checked",!0),jQuery(c[d]).prop("disabled",!0)),d++;for(c=jQuery(".wppa-search-root-id"),d=0;d<c.length;)jQuery(c[d]).val(b),d++}function wppaSubboxChange(a){jQuery(a).prop("checked")&&jQuery(".wppa-rootbox").each(function(){jQuery(this).prop("checked",!0)})}function wppaClearSubsearch(){for(var a=jQuery(".wppa-display-searchstring"),b=0;b<a.length;)jQuery(a[b]).html(""),b++;for(a=jQuery(".wppa-search-sub-box"),b=0;b<a.length;)jQuery(a[b]).attr("disabled","disabled"),b++}function wppaEnableSubsearch(){for(var a=jQuery(".wppa-search-sub-box"),b=0;b<a.length;)jQuery(a[b]).removeAttr("disabled"),b++}function wppaDisplaySelectedFiles(a){for(var b=jQuery("#"+a),c=0,d="";c<b[0].files.length;)d+=b[0].files[c].name+" ",c++;jQuery("#"+a+"-display").val(d)}function wppaIsEmpty(a){return!(null!=a)||!("undefined"!=typeof a)||!(""!=a)||!(!1!=a)||!(0!=a)||void 0}function wppaGetUploadOptions(yalb,mocc,where,onComplete){var options={beforeSend:function(){jQuery("#progress-"+yalb+"-"+mocc).show(),jQuery("#bar-"+yalb+"-"+mocc).width("0%"),jQuery("#message-"+yalb+"-"+mocc).html(""),jQuery("#percent-"+yalb+"-"+mocc).html("")},uploadProgress:function(a,b,c,d){jQuery("#bar-"+yalb+"-"+mocc).css("backgroundColor","#7F7"),jQuery("#bar-"+yalb+"-"+mocc).width(d+"%"),95>d?jQuery("#percent-"+yalb+"-"+mocc).html(d+"%"):jQuery("#percent-"+yalb+"-"+mocc).html(wppaProcessing)},success:function(){jQuery("#bar-"+yalb+"-"+mocc).width("100%"),jQuery("#percent-"+yalb+"-"+mocc).html(wppaDone),jQuery(".wppa-upload-button").val(wppaUploadButtonText)},complete:function(response){-1==response.responseText.indexOf(wppaUploadFailed)?(jQuery("#message-"+yalb+"-"+mocc).html("<span style=\"font-size: 10px;\" >"+response.responseText+"</span>"),("thumb"==where||"cover"==where)&&eval(onComplete)):(jQuery("#bar-"+yalb+"-"+mocc).css("backgroundColor","#F77"),jQuery("#percent-"+yalb+"-"+mocc).html(wppaUploadFailed),jQuery("#message-"+yalb+"-"+mocc).html("<span style=\"font-size: 10px;\" >"+response.responseText+"</span>"))},error:function(){jQuery("#message-"+yalb+"-"+mocc).html("<span style=\"color: red;\" >"+wppaServerError+"</span>"),jQuery("#bar-"+yalb+"-"+mocc).css("backgroundColor","#F77"),jQuery("#percent-"+yalb+"-"+mocc).html(wppaUploadFailed)}};return options}wppaConsoleLog("wppa.js version 7.1.00 loaded.","force");
readme.txt CHANGED
@@ -139,10 +139,9 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
139
 
140
  = 7.1.00 =
141
 
142
- * The audiostub image file was overwritten by the last audio posterfile. Fixed.
143
- * There is now only one upload box on the Photo Albums -> Upload admin page.
144
- You can upload all enabled implemented fietypes including zipfiles at once,
145
- The order of uploading audio/video files and matching poster images is no longer important.
146
 
147
  = 7.0.11 =
148
 
139
 
140
  = 7.1.00 =
141
 
142
+ * This version addresses various bug fixes and feature requests.
143
+ * The Photo Album -> Upload Photos and Import Photos admin pages have been substantially improved.
144
+ Read the changelog for details.
 
145
 
146
  = 7.0.11 =
147
 
wppa-admin-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
- * Version 7.0.09
7
  *
8
  */
9
 
@@ -489,16 +489,10 @@ function wppa_sanitize_files() {
489
  }
490
 
491
  function _wppa_sanitze_files( $root ) {
492
- global $wppa_supported_video_extensions;
493
- global $wppa_supported_audio_extensions;
494
 
495
- // See what's in there
496
- $allowed_types = array( 'zip', 'jpg', 'jpeg', 'png', 'gif', 'amf', 'pmf', 'bak', 'log', 'csv' );
497
- if ( is_array( $wppa_supported_video_extensions ) ) {
498
- $allowed_types = array_merge( $allowed_types, $wppa_supported_video_extensions );
499
- }
500
- if ( is_array( $wppa_supported_audio_extensions ) ) {
501
- $allowed_types = array_merge( $allowed_types, $wppa_supported_audio_extensions );
502
  }
503
 
504
  $paths = $root.'/*';
@@ -506,8 +500,17 @@ global $wppa_supported_audio_extensions;
506
 
507
  $count = '0';
508
  if ( $files ) foreach ( $files as $file ) {
 
 
 
 
 
 
 
 
509
  if ( is_file( $file ) ) {
510
- $ext = strtolower( substr( strrchr( $file, "." ), 1 ) );
 
511
  if ( ! in_array( $ext, $allowed_types ) ) {
512
  if ( basename( $file ) != 'index.php' ) {
513
  unlink( $file );
@@ -730,7 +733,7 @@ global $warning_given_small;
730
 
731
  // If not dups allowed and its already here, quit
732
  if ( isset( $_POST['wppa-nodups'] ) || wppa_switch( 'void_dups' ) ) {
733
- $exists = wppa_file_is_in_album( $filename, $alb );
734
  if ( $exists ) {
735
  if ( isset( $_POST['del-after-p'] ) ) {
736
  unlink( $file );
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
+ * Version 7.1.00
7
  *
8
  */
9
 
489
  }
490
 
491
  function _wppa_sanitze_files( $root ) {
 
 
492
 
493
+ $allowed_types = wppa_get_supported_extensions();
494
+ if ( wppa_user_is( 'administrator' ) ) {
495
+ $allowed_types = array_merge( $allowed_types, array( 'amf', 'pmf', 'csv' ) );
 
 
 
 
496
  }
497
 
498
  $paths = $root.'/*';
500
 
501
  $count = '0';
502
  if ( $files ) foreach ( $files as $file ) {
503
+
504
+ // Make sure file ext is downcase
505
+ $dfile = wppa_down_ext( $file );
506
+ if ( $dfile != $file ) {
507
+ wppa_rename( $file, $dfile );
508
+ $file = $dfile;
509
+ }
510
+
511
  if ( is_file( $file ) ) {
512
+
513
+ $ext = wppa_get_ext( $file );
514
  if ( ! in_array( $ext, $allowed_types ) ) {
515
  if ( basename( $file ) != 'index.php' ) {
516
  unlink( $file );
733
 
734
  // If not dups allowed and its already here, quit
735
  if ( isset( $_POST['wppa-nodups'] ) || wppa_switch( 'void_dups' ) ) {
736
+ $exists = wppa_is_file_duplicate_photo( $filename, $alb );
737
  if ( $exists ) {
738
  if ( isset( $_POST['del-after-p'] ) ) {
739
  unlink( $file );
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 7.0.12
6
  *
7
  */
8
 
@@ -2097,7 +2097,7 @@ global $wppa_log_file;
2097
  WHERE id = %d", $photo ), ARRAY_A );
2098
 
2099
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2100
- $exists = wppa_file_is_in_album( $photodata['filename'], $value );
2101
  if ( $exists ) { // Already exists
2102
  echo '||3||' . sprintf ( __( 'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photodata['filename'], $value );
2103
  wppa_exit();
@@ -2129,7 +2129,7 @@ global $wppa_log_file;
2129
  WHERE id = %d", $photo ), ARRAY_A );
2130
 
2131
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2132
- $exists = wppa_file_is_in_album( $photodata['filename'], $value );
2133
  if ( $exists ) { // Already exists
2134
  echo '||4||' . sprintf( __( 'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photodata['filename'], $value );
2135
  wppa_exit();
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 7.1.00
6
  *
7
  */
8
 
2097
  WHERE id = %d", $photo ), ARRAY_A );
2098
 
2099
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2100
+ $exists = wppa_is_file_duplicate_photo( $photodata['filename'], $value );
2101
  if ( $exists ) { // Already exists
2102
  echo '||3||' . sprintf ( __( 'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photodata['filename'], $value );
2103
  wppa_exit();
2129
  WHERE id = %d", $photo ), ARRAY_A );
2130
 
2131
  if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
2132
+ $exists = wppa_is_file_duplicate_photo( $photodata['filename'], $value );
2133
  if ( $exists ) { // Already exists
2134
  echo '||4||' . sprintf( __( 'A photo with filename %s already exists in album %s.' , 'wp-photo-album-plus'), $photodata['filename'], $value );
2135
  wppa_exit();
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.0.12
7
  *
8
  */
9
 
@@ -4651,7 +4651,7 @@ global $wppa_alert;
4651
 
4652
  // Check for already exists
4653
  if ( wppa_switch( 'void_dups' ) ) {
4654
- if ( wppa_file_is_in_album( wppa_sanitize_file_name( $file['name'] ), $alb ) ) {
4655
  $wppa_alert .= esc_js( sprintf( __( 'Uploaded file %s already exists in this album.' , 'wp-photo-album-plus'), wppa_sanitize_file_name( $file['name'] ) ) );
4656
  return false;
4657
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 7.1,00
7
  *
8
  */
9
 
4651
 
4652
  // Check for already exists
4653
  if ( wppa_switch( 'void_dups' ) ) {
4654
+ if ( wppa_is_file_duplicate_photo( wppa_sanitize_file_name( $file['name'] ), $alb ) ) {
4655
  $wppa_alert .= esc_js( sprintf( __( 'Uploaded file %s already exists in this album.' , 'wp-photo-album-plus'), wppa_sanitize_file_name( $file['name'] ) ) );
4656
  return false;
4657
  }
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 7.0.09
7
  *
8
  */
9
 
@@ -16,6 +16,7 @@ global $wpdb;
16
  global $wppa_supported_photo_extensions;
17
  global $wppa_supported_video_extensions;
18
  global $wppa_supported_audio_extensions;
 
19
  global $wppa_session;
20
 
21
  if ( wppa( 'ajax' ) ) ob_start(); // Suppress output if ajax operation
@@ -69,12 +70,16 @@ global $wppa_session;
69
  if ( isset( $_POST['wppa-audio-album'] ) ) {
70
  update_option( 'wppa-audio-album-import-'.wppa_get_user(), strval( intval( $_POST['wppa-audio-album'] ) ) );
71
  }
 
 
 
72
 
73
  // Link from album admin overrules last album
74
  if ( isset( $_GET['wppa-set-album'] ) ) {
75
  update_option( 'wppa-photo-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
76
  update_option( 'wppa-video-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
77
  update_option( 'wppa-audio-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
 
78
  }
79
 
80
  // Verify last albums still exist
@@ -93,6 +98,11 @@ global $wppa_session;
93
  $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE id = %s", $alb ) );
94
  if ( ! $exists ) update_option( 'wppa-audio-album-import-'.wppa_get_user(), '0' );
95
  }
 
 
 
 
 
96
 
97
  // Extract zip
98
  if ( isset( $_GET['zip'] ) ) {
@@ -135,14 +145,15 @@ global $wppa_session;
135
  check_admin_referer( '$wppa_nonce', WPPA_NONCE );
136
  }
137
  $delp = isset( $_POST['del-after-p'] );
138
- $delf = isset( $_POST['del-after-f'] );
139
  $dela = isset( $_POST['del-after-a'] );
140
  $delz = isset( $_POST['del-after-z'] );
141
  $delv = isset( $_POST['del-after-v'] );
142
  $delu = isset( $_POST['del-after-u'] );
143
  $delc = isset( $_POST['del-after-c'] );
 
144
 
145
- wppa_import_photos( $delp, $dela, $delz, $delv, $delu, $delc, $delf );
146
  }
147
 
148
  // Continue dirimport after timeout
@@ -203,14 +214,15 @@ global $wppa_session;
203
  }
204
 
205
  // See what's in there
206
- $files = wppa_get_import_files();
207
- $zipcount = wppa_get_zipcount( $files );
208
- $albumcount = wppa_get_albumcount( $files );
209
- $photocount = wppa_get_photocount( $files );
210
- $videocount = wppa_get_video_count( $files );
211
- $audiocount = wppa_get_audio_count( $files );
212
- $dircount = $is_depot ? wppa_get_dircount( $files ) : '0';
213
- $csvcount = $is_depot ? wppa_get_csvcount( $files ) : '0';
 
214
 
215
  if ( $ngg_opts ) {
216
  $is_ngg = strpos( $source, $ngg_opts['gallerypath'] ) !== false; // this is false for the ngg root !!
@@ -234,6 +246,7 @@ global $wppa_session;
234
  $audiocount = '0';
235
  $dircount = '0';
236
  $csvcount = '0';
 
237
  $is_ngg = false;
238
  $remote_max = get_option( 'wppa_import_remote_max_'.$user, '10' );
239
  }
@@ -265,7 +278,6 @@ global $wppa_session;
265
  '<span id="rem-rem-0" style="display:none;" >' .
266
  ' ' . __( 'Working, please wait...', 'wp-photo-album-plus') .
267
  '</span>';
268
- ;
269
 
270
  if ( $can_remote ) {
271
 
@@ -393,7 +405,7 @@ global $wppa_session;
393
  }
394
 
395
  // Something to import?
396
- if ( $photocount || $albumcount || $zipcount || $dircount || $videocount || $audiocount || $csvcount ) {
397
 
398
  // Open the form
399
  echo
@@ -568,10 +580,10 @@ global $wppa_session;
568
  // Local
569
  if ( $source_type == 'local' ) {
570
  if ( $is_ngg ) {
571
- printf( _n( 'There is %d photo in the ngg gallery', 'There are %d photos in the ngg gallery', $photocount, 'wp-photo-album-plus' ), $photocount );
572
  }
573
  else {
574
- printf( _n( 'There is %d photo in the depot', 'There are %d photos in the depot', $photocount, 'wp-photo-album-plus' ), $photocount );
575
  }
576
  }
577
 
@@ -969,6 +981,7 @@ global $wppa_session;
969
  ' >' .
970
  '&nbsp;&nbsp;' .
971
  wppa_sanitize_file_name( basename( $file ) ) .
 
972
  '</span>' .
973
  '</td>';
974
  if ( $ct == 3 ) {
@@ -1081,6 +1094,7 @@ global $wppa_session;
1081
  ' >' .
1082
  '&nbsp;&nbsp;' .
1083
  wppa_sanitize_file_name( basename( $file ) ) .
 
1084
  '</span>' .
1085
  '</td>';
1086
  if ( $ct == 3 ) {
@@ -1099,18 +1113,18 @@ global $wppa_session;
1099
  '</div>';
1100
  }
1101
 
1102
- // Display the directories to be imported as albums. Do this in the depot only!!
1103
- if ( $is_depot && $dircount ) {
1104
  echo
1105
  '<div style="border:1px solid gray; padding:4px; margin: 3px 0;" >';
1106
 
1107
- // Display number of dirs
1108
  echo
1109
  '<p><b>' .
1110
- sprintf( _n( 'There is %d albumdirectory in the depot', 'There are %d albumdirectories in the depot', $dircount, 'wp-photo-album-plus' ), $dircount ) .
1111
  '</b></p>';
1112
 
1113
- // Header of dirlist
1114
  echo
1115
  '<table class="form-table wppa-table widefat" style="margin-bottom:0;" >' .
1116
  '<thead>' .
@@ -1118,58 +1132,54 @@ global $wppa_session;
1118
  '<td>' .
1119
  '<input' .
1120
  ' type="checkbox"' .
1121
- ' id="all-dir"' .
1122
  ' checked="checked"' .
1123
- ' onchange="checkAll( \'all-dir\', \'.wppa-dir\' )"' .
1124
  ' />' .
1125
  '<b>' .
1126
  '&nbsp;&nbsp;' .
1127
  __( 'Check/uncheck all', 'wp-photo-album-plus') .
1128
  '</b>' .
1129
  '</td>' .
 
 
 
 
 
 
 
 
 
 
 
 
 
1130
  '</tr>' .
1131
  '</thead>' .
1132
  '</table>';
1133
 
1134
- // Dirlist
1135
  echo
1136
  '<table class="form-table wppa-table widefat" style="margin-top:0;" >';
1137
  $ct = 0;
1138
  $idx = '0';
1139
- foreach( $files as $dir ) {
1140
- if ( basename( $dir ) == '.' ) {}
1141
- elseif ( basename( $dir ) == '..' ) {}
1142
- elseif ( wppa_is_dir( $dir ) ) {
1143
  echo
1144
  '<tr>' .
1145
  '<td>' .
1146
  '<input' .
1147
  ' type="checkbox"' .
1148
  ' id="file-' . $idx . '"' .
1149
- ' name="file-' . $idx .'"' .
1150
- ' class= "wppa-dir"' .
1151
  ' checked="checked"' .
1152
  ' />' .
1153
  '&nbsp;&nbsp;' .
1154
  '<b>' .
1155
- wppa_sanitize_file_name( basename( $dir ) ) .
1156
- '</b>';
1157
- $subfiles = wppa_glob( $dir.'/*' );
1158
- $subdircount = '0';
1159
- if ( $subfiles ) {
1160
- foreach ( $subfiles as $subfile ) {
1161
- if ( wppa_is_dir( $subfile ) && basename( $subfile ) != '.' && basename( $subfile ) != '..' ) {
1162
- $subdircount++;
1163
- }
1164
- }
1165
- }
1166
- $sfcount = empty( $subfiles ) ? '0' : wppa_get_photocount( $subfiles );
1167
- echo ' ' .
1168
- sprintf( _n( 'Contains %d file', 'Contains %d files', $sfcount, 'wp-photo-album-plus' ), $sfcount );
1169
- if ( $subdircount ) {
1170
- echo ' ' .
1171
- sprintf( _n( 'and %d subdirectory', 'and %d subdirectories', $subdircount, 'wp-photo-album-plus' ), $subdircount );
1172
- }
1173
  '</td>' .
1174
  '</tr>';
1175
  }
@@ -1180,18 +1190,38 @@ global $wppa_session;
1180
  '</div>';
1181
  }
1182
 
1183
- // Display the csv files
1184
- if ( $is_depot && $csvcount ) {
1185
  echo
1186
  '<div style="border:1px solid gray; padding:4px; margin: 3px 0;" >';
1187
 
1188
  // Display number of files
1189
  echo
1190
  '<p><b>' .
1191
- sprintf( _n( 'There is %d .csv file in the depot', 'There are %d .csv files in the depot', $csvcount, 'wp-photo-album-plus' ), $csvcount ) .
1192
  '</b></p>';
1193
 
1194
- // Header of .csv file list
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1195
  echo
1196
  '<table class="form-table wppa-table widefat" style="margin-bottom:0;" >' .
1197
  '<thead>' .
@@ -1199,9 +1229,9 @@ global $wppa_session;
1199
  '<td>' .
1200
  '<input' .
1201
  ' type="checkbox"' .
1202
- ' id="all-csv"' .
1203
  ' checked="checked"' .
1204
- ' onchange="checkAll( \'all-csv\', \'.wppa-csv\' )"' .
1205
  ' />' .
1206
  '<b>' .
1207
  '&nbsp;&nbsp;' .
@@ -1211,10 +1241,9 @@ global $wppa_session;
1211
  '<td>' .
1212
  '<input' .
1213
  ' type="checkbox"' .
1214
- ' id="del-after-c"' .
1215
- ' name="del-after-c"' .
1216
  ' checked="checked"' .
1217
- ' disabled="disabled"' .
1218
  ' />' .
1219
  '<b>' .
1220
  '&nbsp;&nbsp;' .
@@ -1225,28 +1254,120 @@ global $wppa_session;
1225
  '</thead>' .
1226
  '</table>';
1227
 
1228
- // CSV file list
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1229
  echo
1230
  '<table class="form-table wppa-table widefat" style="margin-top:0;" >';
1231
  $ct = 0;
1232
  $idx = '0';
1233
- foreach( $files as $csv ) {
1234
- if ( wppa_is_file( $csv ) && strtolower( wppa_get_ext( $csv ) ) == 'csv' ) {
 
 
1235
  echo
1236
  '<tr>' .
1237
  '<td>' .
1238
  '<input' .
1239
  ' type="checkbox"' .
1240
  ' id="file-' . $idx . '"' .
1241
- ' name="file-' . $idx . '"' .
1242
- ' class="wppa-csv"' .
1243
  ' checked="checked"' .
1244
  ' />' .
1245
  '&nbsp;&nbsp;' .
1246
  '<b>' .
1247
- wppa_sanitize_file_name( basename( $csv ) ) .
1248
- ' (' . sprintf( '%5.1f', filesize( $csv ) / 1024 ) . ' kb)' .
1249
- '</b>' .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1250
  '</td>' .
1251
  '</tr>';
1252
  }
@@ -1267,6 +1388,7 @@ global $wppa_session;
1267
  if ( ! parseInt( jQuery( '#wppa-photo-album' ).attr( 'value' ) ) &&
1268
  ! parseInt( jQuery( '#wppa-video-album' ).attr( 'value' ) ) &&
1269
  ! parseInt( jQuery( '#wppa-audio-album' ).attr( 'value' ) ) &&
 
1270
  csvs.length == 0
1271
  ) {
1272
  alert( 'Please select an album first' );
@@ -1325,6 +1447,7 @@ global $wppa_session;
1325
  data += '&wppa-photo-album='+jQuery( '#wppa-photo-album' ).attr( 'value' );
1326
  data += '&wppa-video-album='+jQuery( '#wppa-video-album' ).attr( 'value' );
1327
  data += '&wppa-audio-album='+jQuery( '#wppa-audio-album' ).attr( 'value' );
 
1328
  data += '&wppa-watermark-file='+jQuery( '#wppa-watermark-file' ).attr( 'value' );
1329
  data += '&wppa-watermark-pos='+jQuery( '#wppa-watermark-pos' ).attr( 'value' );
1330
  if ( jQuery( '#cre-album' ).attr( 'checked' ) ) data += '&cre-album='+jQuery( '#cre-album' ).attr( 'value' );
@@ -1335,6 +1458,7 @@ global $wppa_session;
1335
  if ( jQuery( '#del-after-f' ).attr( 'checked' ) ) data += '&del-after-f=on';
1336
  if ( jQuery( '#del-after-v' ).attr( 'checked' ) ) data += '&del-after-v=on';
1337
  if ( jQuery( '#del-after-u' ).attr( 'checked' ) ) data += '&del-after-u=on';
 
1338
  data += '&wppa-import-submit=ajax';
1339
 
1340
  var files = jQuery( ':checked' );
@@ -1364,6 +1488,7 @@ global $wppa_session;
1364
  if ( xmlhttp.readyState == 4 ) {
1365
  if ( xmlhttp.status!=404 ) {
1366
  var resp = xmlhttp.responseText;
 
1367
  //
1368
  if ( resp.length == 0 ) {
1369
  jQuery( '#name-'+elm.id ).html('<span style="color:red" >Timeout</span>' );
@@ -1409,7 +1534,7 @@ global $wppa_session;
1409
  jQuery( '#wppa-spinner' ).css( 'display', 'none' );
1410
  }
1411
  </script>
1412
- <?php if ( ( $photocount || $videocount || $audiocount ) && ! $albumcount && ! $dircount && ! $zipcount && ! $csvcount ) { ?>
1413
  <input id="wppa-start-ajax" type="button" onclick="if ( wppaVfyAlbum() ) { wppaImportRuns = true;wppaDoAjaxImport() }" class="button-primary" value="<?php esc_attr( _e( 'Start Import', 'wp-photo-album-plus' ) ) ?>" />
1414
  <input id="wppa-stop-ajax" style="display:none;" type="button" onclick="wppaStopAjaxImport()" class="button-primary" value="<?php esc_attr( _e( 'Stop Import', 'wp-photo-album-plus' ) ) ?>" />
1415
  <?php } ?>
@@ -1453,12 +1578,16 @@ global $wppa_session;
1453
  echo ' .'.$ext;
1454
  }
1455
  }
 
 
 
 
1456
  echo '<br />';
1457
  _e( 'WPPA+ file types: .amf .pmf', 'wp-photo-album-plus' );
1458
  echo '<br />';
1459
- _e( 'Directories with optional subdirs containig photos', 'wp-photo-album-plus' );
1460
- echo '<br />';
1461
  _e( 'Custom data files of type .csv', 'wp-photo-album-plus' );
 
 
1462
  echo '<br /><br />';
1463
  _e( 'Your depot directory is:', 'wp-photo-album-plus' );
1464
  echo '<b> .../' . WPPA_DEPOT . '/</b>';
@@ -1651,12 +1780,13 @@ return;
1651
  }
1652
 
1653
  // Do the import photos
1654
- function wppa_import_photos( $delp = false, $dela = false, $delz = false, $delv = false, $delu = false, $delc = false, $delf = false ) {
1655
  global $wpdb;
1656
  global $warning_given;
1657
  global $wppa_supported_photo_extensions;
1658
  global $wppa_supported_video_extensions;
1659
  global $wppa_supported_audio_extensions;
 
1660
 
1661
  $warning_given = false;
1662
 
@@ -1829,7 +1959,7 @@ global $wppa_supported_audio_extensions;
1829
  if ( in_array( $ext, $wppa_supported_photo_extensions ) ) {
1830
 
1831
  // See if a metafile exists
1832
- //$meta = substr( $file, 0, strlen( $file ) - 3 ).'pmf';
1833
  $meta = wppa_strip_ext( $unsanitized_path_name ) . '.PMF';
1834
  if ( ! is_file( $meta ) ) {
1835
  $meta = wppa_strip_ext( $unsanitized_path_name ) . '.pmf';
@@ -1853,34 +1983,43 @@ global $wppa_supported_audio_extensions;
1853
  $linktitle = '';
1854
  }
1855
 
1856
- // If there is a video or audio with the same name, this is the poster.
1857
- $is_poster = wppa_file_is_in_album( wppa_strip_ext( basename( $file ) ) . '.xxx', $alb );
 
 
1858
  if ( $is_poster ) {
1859
 
1860
- // Delete possible poster sourcefile
1861
- wppa_delete_source( basename( $file ), $alb );
1862
 
1863
  // Remove possible existing posters, the file-extension may be different as before
1864
- $old_photo = wppa_strip_ext( wppa_get_photo_path( $is_poster, false ) );
1865
- $old_thumb = wppa_strip_ext( wppa_get_thumb_path( $is_poster, false ) );
1866
- foreach ( $wppa_supported_photo_extensions as $pext ) {
1867
- if ( is_file( $old_photo . '.' . $pext ) ) wppa_unlink( $old_photo . '.' . $pext );
1868
- if ( is_file( $old_thumb . '.' . $pext ) ) wppa_unlink( $old_thumb . '.' . $pext );
1869
- }
1870
 
1871
  // Clear sizes on db
1872
- wppa_update_photo( array( 'thumbx' => '0',
 
1873
  'thumby' => '0',
1874
  'photox' => '0',
1875
  'photoy' => '0'
1876
  ));
 
 
 
 
 
 
 
 
1877
 
1878
  // Make new files
1879
  $bret = wppa_make_the_photo_files( $file, $is_poster, strtolower( wppa_get_ext( basename( $file ) ) ) );
1880
  if ( $bret ) { // Success
1881
  if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files_done', true );
1882
- wppa_save_source( $file, basename( $file ), $alb );
1883
- wppa_make_o1_source( $is_poster );
1884
  $pcount++;
1885
  $totpcount += $bret;
1886
  if ( $delp ) {
@@ -1932,7 +2071,7 @@ global $wppa_supported_audio_extensions;
1932
  else {
1933
  $id = basename( $file );
1934
  }
1935
- if ( wppa_switch( 'void_dups' ) && wppa_file_is_in_album( $id, $alb ) ) {
1936
  wppa_warning_message( sprintf( __( 'Photo %s already exists in album %s. (1)', 'wp-photo-album-plus'), $id, $alb ) );
1937
  wppa( 'ajax_import_files_error', __( 'Duplicate', 'wp-photo-album-plus') );
1938
  if ( $delf ) {
@@ -2015,10 +2154,10 @@ global $wppa_supported_audio_extensions;
2015
  // Now the video files
2016
  $videocount = '0';
2017
  $alb = isset( $_POST['wppa-video-album'] ) ? $_POST['wppa-video-album'] : '0';
2018
- if ( wppa( 'ajax' ) && ! $alb ) {
2019
- wppa( 'ajax_import_files_error', __( 'Unknown album', 'wp-photo-album-plus' ) );
2020
- }
2021
- else foreach ( array_keys( $files ) as $idx ) {
2022
  $file = $files[$idx];
2023
  if ( isset( $_POST['file-'.$idx] ) || wppa( 'ajax' ) ) {
2024
  if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files', wppa_sanitize_file_name( basename( $file ) ) ); /* */
@@ -2026,56 +2165,18 @@ global $wppa_supported_audio_extensions;
2026
  if ( in_array( $ext, $wppa_supported_video_extensions ) ) {
2027
  if ( is_numeric( $alb ) && $alb != '0' ) {
2028
 
2029
- // Do we have this filename with ext xxx in this album?
2030
- $filename = wppa_strip_ext( basename( $file ) ).'.xxx';
2031
- $id = wppa_file_is_in_album( $filename, $alb );
2032
-
2033
- // Or maybe the poster is already there
2034
- foreach ( $wppa_supported_photo_extensions as $pext ) {
2035
- if ( ! $id ) {
2036
- $id = wppa_file_is_in_album( str_replace( 'xxx', $pext, $filename ), $alb );
2037
- }
2038
- }
2039
-
2040
- // This filename already exists: is the poster. Fix the filename in the photo info
2041
- if ( $id ) {
2042
- $fname = wppa_get_photo_item( $id, 'filename' );
2043
- $fname = wppa_strip_ext( $fname ) . '.xxx';
2044
-
2045
- // Fix filename and ext in photo info
2046
- wppa_update_photo( array( 'id' => $id, 'filename' => $fname, 'ext' => 'xxx' ) );
2047
- }
2048
-
2049
- // Add new entry
2050
- if ( ! $id ) {
2051
- $id = wppa_create_photo_entry( array( 'album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => wppa_strip_ext( $filename ) ) );
2052
- wppa_invalidate_treecounts( $alb );
2053
- }
2054
-
2055
- // Add video filetype
2056
- $newpath = wppa_strip_ext( wppa_get_photo_path( $id, false ) ).'.'.$ext;
2057
- $fs = filesize( $file );
2058
- if ( $fs > 1024*1024*64 || $delv ) { // copy fails for files > 64 Mb
2059
-
2060
- // Remove old version if already exists
2061
- if ( wppa_is_file( $newpath ) ) {
2062
- wppa_unlink( $newpath );
2063
  }
2064
- wppa_rename( $file, $newpath );
2065
- }
2066
- else {
2067
- wppa_copy( $file, $newpath );
2068
- }
2069
-
2070
- if ( wppa( 'ajax' ) ) {
2071
- wppa( 'ajax_import_files_done', true );
2072
  }
2073
-
2074
- // Make sure ext is set to xxx after adding video to an existing poster
2075
- wppa_update_photo( array( 'id' => $id, 'ext' => 'xxx' ) );
2076
-
2077
- // Book keeping
2078
- $videocount++;
2079
  }
2080
  else {
2081
  wppa_error_message( sprintf( __( 'Error inserting video %s, unknown or non existent album.', 'wp-photo-album-plus'), basename( $file ) ) );
@@ -2087,10 +2188,10 @@ global $wppa_supported_audio_extensions;
2087
  // Now the audio files
2088
  $audiocount = '0';
2089
  $alb = isset( $_POST['wppa-audio-album'] ) ? $_POST['wppa-audio-album'] : '0';
2090
- if ( wppa( 'ajax' ) && ! $alb ) {
2091
- wppa( 'ajax_import_files_error', __( 'Unknown album', 'wp-photo-album-plus' ) );
2092
- }
2093
- else foreach ( array_keys( $files ) as $idx ) {
2094
  $file = $files[$idx];
2095
  if ( isset( $_POST['file-'.$idx] ) || wppa( 'ajax' ) ) {
2096
  if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files', wppa_sanitize_file_name( basename( $file ) ) );
@@ -2098,50 +2199,55 @@ global $wppa_supported_audio_extensions;
2098
  if ( in_array( $ext, $wppa_supported_audio_extensions ) ) {
2099
  if ( is_numeric( $alb ) && $alb != '0' ) {
2100
 
2101
- // Do we have this filename with ext xxx in this album?
2102
- $filename = wppa_strip_ext( basename( $file ) ).'.xxx';
2103
- $id = wppa_file_is_in_album( $filename, $alb );
2104
-
2105
- // Or maybe the poster is already there
2106
- foreach ( $wppa_supported_photo_extensions as $pext ) {
2107
- if ( ! $id ) {
2108
- $id = wppa_file_is_in_album( str_replace( 'xxx', $pext, $filename ), $alb );
 
2109
  }
 
2110
  }
 
 
 
 
 
 
 
2111
 
2112
- // This filename already exists: is the poster. Fix the filename in the photo info
2113
- if ( $id ) {
2114
- $fname = wppa_get_photo_item( $id, 'filename' );
2115
- $fname = wppa_strip_ext( $fname ) . '.xxx';
2116
-
2117
- // Fix filename and ext in photo info
2118
- wppa_update_photo( array( 'id' => $id, 'filename' => $fname, 'ext' => 'xxx' ) );
2119
- }
2120
-
2121
- // Add new entry
2122
- if ( ! $id ) {
2123
- $id = wppa_create_photo_entry( array( 'album' => $alb, 'filename' => $filename, 'ext' => 'xxx', 'name' => wppa_strip_ext( $filename ) ) );
2124
- wppa_invalidate_treecounts( $alb );
2125
- }
2126
 
2127
- // Add audio filetype
2128
- $newpath = wppa_strip_ext( wppa_get_photo_path( $id, false ) ).'.'.$ext;
2129
- wppa_copy( $file, $newpath );
2130
- if ( $delu ) {
2131
- wppa_unlink( $file );
2132
- }
2133
- if ( wppa( 'ajax' ) ) {
2134
- wppa( 'ajax_import_files_done', true );
 
 
 
2135
  }
2136
-
2137
- // Make sure ext is set to xxx after adding audio to an existing poster
2138
- wppa_update_photo( array( 'id' => $id, 'ext' => 'xxx' ) );
2139
-
2140
- // Book keeping
2141
- $audiocount++;
2142
  }
2143
  else {
2144
- wppa_error_message( sprintf( __( 'Error inserting audio %s, unknown or non existent album.', 'wp-photo-album-plus'), basename( $file ) ) );
2145
  }
2146
  }
2147
  }
@@ -2645,7 +2751,7 @@ global $wppa_supported_audio_extensions;
2645
 
2646
  wppa_ok_message( __( 'Done processing files.', 'wp-photo-album-plus') );
2647
 
2648
- if ( $pcount == '0' && $acount == '0' && $zcount == '0' && $dircount == '0' && $photocount == '0' && $videocount == '0' && $audiocount == '0' && $csvcount == '0' ) {
2649
  wppa_warning_message( __( 'No files to import.', 'wp-photo-album-plus') );
2650
  }
2651
  else {
@@ -2670,6 +2776,9 @@ global $wppa_supported_audio_extensions;
2670
  if ( $audiocount ) {
2671
  $msg .= $audiocount.' '.__( 'Audios imported.', 'wp-photo-album-plus' );
2672
  }
 
 
 
2673
  if ( $csvcount ) {
2674
  $msg .= $csvcount . ' ' . __( 'CSVs imported,', 'wp-photo-album-plus') . ' ' .
2675
  $photos_processed_csv .' '. __( 'items processed.', 'wp-photo-album-plus' ) . ' ' .
@@ -2750,6 +2859,21 @@ global $wppa_supported_audio_extensions;
2750
  return $result;
2751
  }
2752
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2753
 
2754
  // Find dir is new album candidates
2755
  function wppa_get_dircount( $files ) {
@@ -2769,9 +2893,7 @@ function wppa_get_csvcount( $files ) {
2769
  $result = 0;
2770
  if ( $files ) {
2771
  foreach ( $files as $file ) {
2772
- if ( wppa_is_file( $file ) ) {
2773
- if ( strtolower( wppa_get_ext( $file ) ) == 'csv' ) $result++;
2774
- }
2775
  }
2776
  }
2777
  return $result;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 7.1.00
7
  *
8
  */
9
 
16
  global $wppa_supported_photo_extensions;
17
  global $wppa_supported_video_extensions;
18
  global $wppa_supported_audio_extensions;
19
+ global $wppa_supported_document_extensions;
20
  global $wppa_session;
21
 
22
  if ( wppa( 'ajax' ) ) ob_start(); // Suppress output if ajax operation
70
  if ( isset( $_POST['wppa-audio-album'] ) ) {
71
  update_option( 'wppa-audio-album-import-'.wppa_get_user(), strval( intval( $_POST['wppa-audio-album'] ) ) );
72
  }
73
+ if ( isset( $_POST['wppa-document-album'] ) ) {
74
+ update_option( 'wppa-document-album-import-'.wppa_get_user(), strval( intval( $_POST['wppa-document-album'] ) ) );
75
+ }
76
 
77
  // Link from album admin overrules last album
78
  if ( isset( $_GET['wppa-set-album'] ) ) {
79
  update_option( 'wppa-photo-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
80
  update_option( 'wppa-video-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
81
  update_option( 'wppa-audio-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
82
+ update_option( 'wppa-document-album-import-'.wppa_get_user(), strval( intval( $_GET['wppa-set-album'] ) ) );
83
  }
84
 
85
  // Verify last albums still exist
98
  $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE id = %s", $alb ) );
99
  if ( ! $exists ) update_option( 'wppa-audio-album-import-'.wppa_get_user(), '0' );
100
  }
101
+ $alb = get_option( 'wppa-document-album-import-'.wppa_get_user(), '0' );
102
+ if ( $alb ) {
103
+ $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE id = %s", $alb ) );
104
+ if ( ! $exists ) update_option( 'wppa-document-album-import-'.wppa_get_user(), '0' );
105
+ }
106
 
107
  // Extract zip
108
  if ( isset( $_GET['zip'] ) ) {
145
  check_admin_referer( '$wppa_nonce', WPPA_NONCE );
146
  }
147
  $delp = isset( $_POST['del-after-p'] );
148
+ $delf = isset( $_POST['del-after-f'] ); // Del after failed
149
  $dela = isset( $_POST['del-after-a'] );
150
  $delz = isset( $_POST['del-after-z'] );
151
  $delv = isset( $_POST['del-after-v'] );
152
  $delu = isset( $_POST['del-after-u'] );
153
  $delc = isset( $_POST['del-after-c'] );
154
+ $deld = isset( $_POST['del-after-d'] ); // document (.pdf)
155
 
156
+ wppa_import_photos( $delp, $dela, $delz, $delv, $delu, $delc, $delf, $deld );
157
  }
158
 
159
  // Continue dirimport after timeout
214
  }
215
 
216
  // See what's in there
217
+ $files = wppa_get_import_files();
218
+ $zipcount = wppa_get_zipcount( $files );
219
+ $albumcount = wppa_get_albumcount( $files );
220
+ $photocount = wppa_get_photocount( $files );
221
+ $videocount = wppa_get_video_count( $files );
222
+ $audiocount = wppa_get_audio_count( $files );
223
+ $dircount = $is_depot ? wppa_get_dircount( $files ) : '0';
224
+ $csvcount = $is_depot ? wppa_get_csvcount( $files ) : '0';
225
+ $documentcount = wppa_get_documentcount( $files );
226
 
227
  if ( $ngg_opts ) {
228
  $is_ngg = strpos( $source, $ngg_opts['gallerypath'] ) !== false; // this is false for the ngg root !!
246
  $audiocount = '0';
247
  $dircount = '0';
248
  $csvcount = '0';
249
+ $documentcount = '0';
250
  $is_ngg = false;
251
  $remote_max = get_option( 'wppa_import_remote_max_'.$user, '10' );
252
  }
278
  '<span id="rem-rem-0" style="display:none;" >' .
279
  ' ' . __( 'Working, please wait...', 'wp-photo-album-plus') .
280
  '</span>';
 
281
 
282
  if ( $can_remote ) {
283
 
405
  }
406
 
407
  // Something to import?
408
+ if ( $photocount || $albumcount || $zipcount || $dircount || $videocount || $audiocount || $csvcount || $documentcount ) {
409
 
410
  // Open the form
411
  echo
580
  // Local
581
  if ( $source_type == 'local' ) {
582
  if ( $is_ngg ) {
583
+ echo '<br /><b>' . sprintf( _n( 'There is %d photo in the ngg gallery', 'There are %d photos in the ngg gallery', $photocount, 'wp-photo-album-plus' ), $photocount ) . '</b>';
584
  }
585
  else {
586
+ echo '<br /><b>' . sprintf( _n( 'There is %d photo in the depot', 'There are %d photos in the depot', $photocount, 'wp-photo-album-plus' ), $photocount ) . '</b>';
587
  }
588
  }
589
 
981
  ' >' .
982
  '&nbsp;&nbsp;' .
983
  wppa_sanitize_file_name( basename( $file ) ) .
984
+ ' (' . sprintf( '%3.1f', filesize( $file ) / 1024 ) . ' kb)' .
985
  '</span>' .
986
  '</td>';
987
  if ( $ct == 3 ) {
1094
  ' >' .
1095
  '&nbsp;&nbsp;' .
1096
  wppa_sanitize_file_name( basename( $file ) ) .
1097
+ ' (' . sprintf( '%3.1f', filesize( $file ) / 1024 ) . ' kb)' .
1098
  '</span>' .
1099
  '</td>';
1100
  if ( $ct == 3 ) {
1113
  '</div>';
1114
  }
1115
 
1116
+ // Display the csv files
1117
+ if ( $is_depot && $csvcount ) {
1118
  echo
1119
  '<div style="border:1px solid gray; padding:4px; margin: 3px 0;" >';
1120
 
1121
+ // Display number of files
1122
  echo
1123
  '<p><b>' .
1124
+ sprintf( _n( 'There is %d .csv file in the depot', 'There are %d .csv files in the depot', $csvcount, 'wp-photo-album-plus' ), $csvcount ) .
1125
  '</b></p>';
1126
 
1127
+ // Header of .csv file list
1128
  echo
1129
  '<table class="form-table wppa-table widefat" style="margin-bottom:0;" >' .
1130
  '<thead>' .
1132
  '<td>' .
1133
  '<input' .
1134
  ' type="checkbox"' .
1135
+ ' id="all-csv"' .
1136
  ' checked="checked"' .
1137
+ ' onchange="checkAll( \'all-csv\', \'.wppa-csv\' )"' .
1138
  ' />' .
1139
  '<b>' .
1140
  '&nbsp;&nbsp;' .
1141
  __( 'Check/uncheck all', 'wp-photo-album-plus') .
1142
  '</b>' .
1143
  '</td>' .
1144
+ '<td>' .
1145
+ '<input' .
1146
+ ' type="checkbox"' .
1147
+ ' id="del-after-c"' .
1148
+ ' name="del-after-c"' .
1149
+ ' checked="checked"' .
1150
+ ' disabled="disabled"' .
1151
+ ' />' .
1152
+ '<b>' .
1153
+ '&nbsp;&nbsp;' .
1154
+ __( 'Remove from depot after successful import.', 'wp-photo-album-plus' ) .
1155
+ '</b>' .
1156
+ '</td>' .
1157
  '</tr>' .
1158
  '</thead>' .
1159
  '</table>';
1160
 
1161
+ // CSV file list
1162
  echo
1163
  '<table class="form-table wppa-table widefat" style="margin-top:0;" >';
1164
  $ct = 0;
1165
  $idx = '0';
1166
+ if ( is_array( $files ) ) foreach( $files as $csv ) {
1167
+ if ( wppa_is_file( $csv ) && strtolower( wppa_get_ext( $csv ) ) == 'csv' ) {
 
 
1168
  echo
1169
  '<tr>' .
1170
  '<td>' .
1171
  '<input' .
1172
  ' type="checkbox"' .
1173
  ' id="file-' . $idx . '"' .
1174
+ ' name="file-' . $idx . '"' .
1175
+ ' class="wppa-csv"' .
1176
  ' checked="checked"' .
1177
  ' />' .
1178
  '&nbsp;&nbsp;' .
1179
  '<b>' .
1180
+ wppa_sanitize_file_name( basename( $csv ) ) .
1181
+ ' (' . sprintf( '%3.1f', filesize( $csv ) / 1024 ) . ' kb)' .
1182
+ '</b>' .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1183
  '</td>' .
1184
  '</tr>';
1185
  }
1190
  '</div>';
1191
  }
1192
 
1193
+ // Display the document files
1194
+ if ( $is_depot && $documentcount ) {
1195
  echo
1196
  '<div style="border:1px solid gray; padding:4px; margin: 3px 0;" >';
1197
 
1198
  // Display number of files
1199
  echo
1200
  '<p><b>' .
1201
+ sprintf( _n( 'There is %d document file in the depot', 'There are %d document files in the depot', $documentcount, 'wp-photo-album-plus' ), $documentcount ) .
1202
  '</b></p>';
1203
 
1204
+ // Album to import to
1205
+ echo
1206
+ '<p class="hideifupdate" >' .
1207
+ __( 'Album to import to:', 'wp-photo-album-plus') .
1208
+ wppa_album_select_a( array( 'path' => wppa_switch( 'hier_albsel' ),
1209
+ 'selected' => get_option( 'wppa-document-album-import-'.wppa_get_user(), '0' ),
1210
+ 'addpleaseselect' => true,
1211
+ 'checkowner' => true,
1212
+ 'checkupload' => true,
1213
+ 'sort' => true,
1214
+ 'optionclass' => '',
1215
+ 'tagopen' => '<select name="wppa-document-album" id="wppa-document-album" >',
1216
+ 'tagname' => 'wppa-document-album',
1217
+ 'tagid' => 'wppa-document-album',
1218
+ 'tagonchange' => '',
1219
+ 'multiple' => false,
1220
+ 'tagstyle' => '',
1221
+ ) ) .
1222
+ '</p>';
1223
+
1224
+ // Header of .pdf file list
1225
  echo
1226
  '<table class="form-table wppa-table widefat" style="margin-bottom:0;" >' .
1227
  '<thead>' .
1229
  '<td>' .
1230
  '<input' .
1231
  ' type="checkbox"' .
1232
+ ' id="all-pdf"' .
1233
  ' checked="checked"' .
1234
+ ' onchange="checkAll( \'all-pdf\', \'.wppa-pdf\' )"' .
1235
  ' />' .
1236
  '<b>' .
1237
  '&nbsp;&nbsp;' .
1241
  '<td>' .
1242
  '<input' .
1243
  ' type="checkbox"' .
1244
+ ' id="del-after-d"' .
1245
+ ' name="del-after-d"' .
1246
  ' checked="checked"' .
 
1247
  ' />' .
1248
  '<b>' .
1249
  '&nbsp;&nbsp;' .
1254
  '</thead>' .
1255
  '</table>';
1256
 
1257
+ // pdf file list
1258
+ echo
1259
+ '<table class="form-table wppa-table widefat" style="margin-top:0;" >
1260
+ <tr>';
1261
+ $ct = 0;
1262
+ $idx = '0';
1263
+ if ( is_array( $files ) ) foreach( $files as $pdf ) {
1264
+ if ( wppa_is_file( $pdf ) && strtolower( wppa_get_ext( $pdf ) ) == 'pdf' ) {
1265
+ echo
1266
+ '<td>' .
1267
+ '<input' .
1268
+ ' type="checkbox"' .
1269
+ ' id="file-' . $idx . '"' .
1270
+ ' name="file-' . $idx . '"' .
1271
+ ' title="' . esc_attr( $pdf ) . '"' .
1272
+ ' class="wppa-pdf"' .
1273
+ ' checked="checked"' .
1274
+ ' />' .
1275
+ '&nbsp;&nbsp;' .
1276
+ '<span' .
1277
+ ' id="name-file-' . $idx . '"' .
1278
+ ' >' .
1279
+ '&nbsp;&nbsp;' .
1280
+ wppa_sanitize_file_name( basename( $pdf ) ) .
1281
+ ' (' . sprintf( '%3.1f', filesize( $pdf ) / 1024 ) . ' kb)' .
1282
+ '</span>' .
1283
+ '</td>';
1284
+ if ( $ct == 3 ) {
1285
+ echo '</tr><tr>';
1286
+ $ct = 0;
1287
+ }
1288
+ else {
1289
+ $ct++;
1290
+ }
1291
+ }
1292
+ $idx++;
1293
+ }
1294
+ echo
1295
+ '</tr>' .
1296
+ '</table>' .
1297
+ '</div>';
1298
+ }
1299
+
1300
+ // Display the directories to be imported as albums. Do this in the depot only!!
1301
+ if ( $is_depot && $dircount ) {
1302
+ echo
1303
+ '<div style="border:1px solid gray; padding:4px; margin: 3px 0;" >';
1304
+
1305
+ // Display number of dirs
1306
+ echo
1307
+ '<p><b>' .
1308
+ sprintf( _n( 'There is %d albumdirectory in the depot', 'There are %d albumdirectories in the depot', $dircount, 'wp-photo-album-plus' ), $dircount ) .
1309
+ '</b></p>';
1310
+
1311
+ // Header of dirlist
1312
+ echo
1313
+ '<table class="form-table wppa-table widefat" style="margin-bottom:0;" >' .
1314
+ '<thead>' .
1315
+ '<tr>' .
1316
+ '<td>' .
1317
+ '<input' .
1318
+ ' type="checkbox"' .
1319
+ ' id="all-dir"' .
1320
+ ' checked="checked"' .
1321
+ ' onchange="checkAll( \'all-dir\', \'.wppa-dir\' )"' .
1322
+ ' />' .
1323
+ '<b>' .
1324
+ '&nbsp;&nbsp;' .
1325
+ __( 'Check/uncheck all', 'wp-photo-album-plus') .
1326
+ '</b>' .
1327
+ '</td>' .
1328
+ '</tr>' .
1329
+ '</thead>' .
1330
+ '</table>';
1331
+
1332
+ // Dirlist
1333
  echo
1334
  '<table class="form-table wppa-table widefat" style="margin-top:0;" >';
1335
  $ct = 0;
1336
  $idx = '0';
1337
+ foreach( $files as $dir ) {
1338
+ if ( basename( $dir ) == '.' ) {}
1339
+ elseif ( basename( $dir ) == '..' ) {}
1340
+ elseif ( wppa_is_dir( $dir ) ) {
1341
  echo
1342
  '<tr>' .
1343
  '<td>' .
1344
  '<input' .
1345
  ' type="checkbox"' .
1346
  ' id="file-' . $idx . '"' .
1347
+ ' name="file-' . $idx .'"' .
1348
+ ' class= "wppa-dir"' .
1349
  ' checked="checked"' .
1350
  ' />' .
1351
  '&nbsp;&nbsp;' .
1352
  '<b>' .
1353
+ wppa_sanitize_file_name( basename( $dir ) ) .
1354
+ '</b>';
1355
+ $subfiles = wppa_glob( $dir.'/*' );
1356
+ $subdircount = '0';
1357
+ if ( $subfiles ) {
1358
+ foreach ( $subfiles as $subfile ) {
1359
+ if ( wppa_is_dir( $subfile ) && basename( $subfile ) != '.' && basename( $subfile ) != '..' ) {
1360
+ $subdircount++;
1361
+ }
1362
+ }
1363
+ }
1364
+ $sfcount = empty( $subfiles ) ? '0' : wppa_get_photocount( $subfiles );
1365
+ echo ' ' .
1366
+ sprintf( _n( 'Contains %d file', 'Contains %d files', $sfcount, 'wp-photo-album-plus' ), $sfcount );
1367
+ if ( $subdircount ) {
1368
+ echo ' ' .
1369
+ sprintf( _n( 'and %d subdirectory', 'and %d subdirectories', $subdircount, 'wp-photo-album-plus' ), $subdircount );
1370
+ }
1371
  '</td>' .
1372
  '</tr>';
1373
  }
1388
  if ( ! parseInt( jQuery( '#wppa-photo-album' ).attr( 'value' ) ) &&
1389
  ! parseInt( jQuery( '#wppa-video-album' ).attr( 'value' ) ) &&
1390
  ! parseInt( jQuery( '#wppa-audio-album' ).attr( 'value' ) ) &&
1391
+ ! parseInt( jQuery( '#wppa-document-album' ).attr( 'value' ) ) &&
1392
  csvs.length == 0
1393
  ) {
1394
  alert( 'Please select an album first' );
1447
  data += '&wppa-photo-album='+jQuery( '#wppa-photo-album' ).attr( 'value' );
1448
  data += '&wppa-video-album='+jQuery( '#wppa-video-album' ).attr( 'value' );
1449
  data += '&wppa-audio-album='+jQuery( '#wppa-audio-album' ).attr( 'value' );
1450
+ data += '&wppa-document-album='+jQuery( '#wppa-document-album' ).attr( 'value' );
1451
  data += '&wppa-watermark-file='+jQuery( '#wppa-watermark-file' ).attr( 'value' );
1452
  data += '&wppa-watermark-pos='+jQuery( '#wppa-watermark-pos' ).attr( 'value' );
1453
  if ( jQuery( '#cre-album' ).attr( 'checked' ) ) data += '&cre-album='+jQuery( '#cre-album' ).attr( 'value' );
1458
  if ( jQuery( '#del-after-f' ).attr( 'checked' ) ) data += '&del-after-f=on';
1459
  if ( jQuery( '#del-after-v' ).attr( 'checked' ) ) data += '&del-after-v=on';
1460
  if ( jQuery( '#del-after-u' ).attr( 'checked' ) ) data += '&del-after-u=on';
1461
+ if ( jQuery( '#del-after-d' ).attr( 'checked' ) ) data += '&del-after-d=on';
1462
  data += '&wppa-import-submit=ajax';
1463
 
1464
  var files = jQuery( ':checked' );
1488
  if ( xmlhttp.readyState == 4 ) {
1489
  if ( xmlhttp.status!=404 ) {
1490
  var resp = xmlhttp.responseText;
1491
+
1492
  //
1493
  if ( resp.length == 0 ) {
1494
  jQuery( '#name-'+elm.id ).html('<span style="color:red" >Timeout</span>' );
1534
  jQuery( '#wppa-spinner' ).css( 'display', 'none' );
1535
  }
1536
  </script>
1537
+ <?php if ( ( $photocount || $videocount || $audiocount || $documentcount ) && ! $albumcount && ! $dircount && ! $zipcount && ! $csvcount ) { ?>
1538
  <input id="wppa-start-ajax" type="button" onclick="if ( wppaVfyAlbum() ) { wppaImportRuns = true;wppaDoAjaxImport() }" class="button-primary" value="<?php esc_attr( _e( 'Start Import', 'wp-photo-album-plus' ) ) ?>" />
1539
  <input id="wppa-stop-ajax" style="display:none;" type="button" onclick="wppaStopAjaxImport()" class="button-primary" value="<?php esc_attr( _e( 'Stop Import', 'wp-photo-album-plus' ) ) ?>" />
1540
  <?php } ?>
1578
  echo ' .'.$ext;
1579
  }
1580
  }
1581
+ if ( in_array( 'pdf', wppa_get_supported_extensions() ) ) {
1582
+ echo '<br />';
1583
+ _e( 'Document file type: .pdf', 'wp-photo-album-plus' );
1584
+ }
1585
  echo '<br />';
1586
  _e( 'WPPA+ file types: .amf .pmf', 'wp-photo-album-plus' );
1587
  echo '<br />';
 
 
1588
  _e( 'Custom data files of type .csv', 'wp-photo-album-plus' );
1589
+ echo '<br />';
1590
+ _e( 'Directories with optional subdirs containig photos', 'wp-photo-album-plus' );
1591
  echo '<br /><br />';
1592
  _e( 'Your depot directory is:', 'wp-photo-album-plus' );
1593
  echo '<b> .../' . WPPA_DEPOT . '/</b>';
1780
  }
1781
 
1782
  // Do the import photos
1783
+ function wppa_import_photos( $delp = false, $dela = false, $delz = false, $delv = false, $delu = false, $delc = false, $delf = false, $deld = false ) {
1784
  global $wpdb;
1785
  global $warning_given;
1786
  global $wppa_supported_photo_extensions;
1787
  global $wppa_supported_video_extensions;
1788
  global $wppa_supported_audio_extensions;
1789
+ global $wppa_supported_document_extensions;
1790
 
1791
  $warning_given = false;
1792
 
1959
  if ( in_array( $ext, $wppa_supported_photo_extensions ) ) {
1960
 
1961
  // See if a metafile exists
1962
+ // $meta = substr( $file, 0, strlen( $file ) - 3 ).'pmf';
1963
  $meta = wppa_strip_ext( $unsanitized_path_name ) . '.PMF';
1964
  if ( ! is_file( $meta ) ) {
1965
  $meta = wppa_strip_ext( $unsanitized_path_name ) . '.pmf';
1983
  $linktitle = '';
1984
  }
1985
 
1986
+ // If there is a video or audio or document with the same name, this is the poster.
1987
+ // Current item is a photo here, so need not check on duplicate photo
1988
+ $is_poster = wppa_is_file_alias( $file, $alb );
1989
+
1990
  if ( $is_poster ) {
1991
 
1992
+ // // Delete possible poster sourcefile
1993
+ // wppa_delete_source( basename( $file ), $alb );
1994
 
1995
  // Remove possible existing posters, the file-extension may be different as before
1996
+ // $old_photo = wppa_strip_ext( wppa_get_photo_path( $is_poster, false ) );
1997
+ // $old_thumb = wppa_strip_ext( wppa_get_thumb_path( $is_poster, false ) );
1998
+ // foreach ( $wppa_supported_photo_extensions as $pext ) {
1999
+ // if ( is_file( $old_photo . '.' . $pext ) ) wppa_unlink( $old_photo . '.' . $pext );
2000
+ // if ( is_file( $old_thumb . '.' . $pext ) ) wppa_unlink( $old_thumb . '.' . $pext );
2001
+ // }
2002
 
2003
  // Clear sizes on db
2004
+ wppa_update_photo( array( 'id' => $is_poster,
2005
+ 'thumbx' => '0',
2006
  'thumby' => '0',
2007
  'photox' => '0',
2008
  'photoy' => '0'
2009
  ));
2010
+ if ( wppa_get_photo_item( $is_poster, 'ext' ) == 'pdf' ) {
2011
+ wppa_update_photo( array( 'id' => $is_poster,
2012
+ 'ext' => wppa_get_ext( basename( $file ) )
2013
+ ) );
2014
+ }
2015
+
2016
+ wppa_save_source( $file, basename( $file ), $alb );
2017
+ wppa_make_o1_source( $is_poster );
2018
 
2019
  // Make new files
2020
  $bret = wppa_make_the_photo_files( $file, $is_poster, strtolower( wppa_get_ext( basename( $file ) ) ) );
2021
  if ( $bret ) { // Success
2022
  if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files_done', true );
 
 
2023
  $pcount++;
2024
  $totpcount += $bret;
2025
  if ( $delp ) {
2071
  else {
2072
  $id = basename( $file );
2073
  }
2074
+ if ( wppa_switch( 'void_dups' ) && wppa_is_file_duplicate_photo( $id, $alb ) ) {
2075
  wppa_warning_message( sprintf( __( 'Photo %s already exists in album %s. (1)', 'wp-photo-album-plus'), $id, $alb ) );
2076
  wppa( 'ajax_import_files_error', __( 'Duplicate', 'wp-photo-album-plus') );
2077
  if ( $delf ) {
2154
  // Now the video files
2155
  $videocount = '0';
2156
  $alb = isset( $_POST['wppa-video-album'] ) ? $_POST['wppa-video-album'] : '0';
2157
+ // if ( wppa( 'ajax' ) && ! $alb ) {
2158
+ // wppa( 'ajax_import_files_error', __( 'Unknown album v', 'wp-photo-album-plus' ) );
2159
+ // }
2160
+ if ( $alb ) foreach ( array_keys( $files ) as $idx ) {
2161
  $file = $files[$idx];
2162
  if ( isset( $_POST['file-'.$idx] ) || wppa( 'ajax' ) ) {
2163
  if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files', wppa_sanitize_file_name( basename( $file ) ) ); /* */
2165
  if ( in_array( $ext, $wppa_supported_video_extensions ) ) {
2166
  if ( is_numeric( $alb ) && $alb != '0' ) {
2167
 
2168
+ $the_file = array( 'name' => sanitize_file_name( basename( $file ) ),
2169
+ 'tmp_name' => $file,
2170
+ 'error' => 0,
2171
+ );
2172
+ if ( wppa_upload_one_item( $the_file, $alb, 'import' ) ) {
2173
+ if ( $delv ) {
2174
+ if ( wppa_is_file( $file ) ) {
2175
+ wppa_unlink( $file );
2176
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2177
  }
2178
+ $videocount++;
 
 
 
 
 
 
 
2179
  }
 
 
 
 
 
 
2180
  }
2181
  else {
2182
  wppa_error_message( sprintf( __( 'Error inserting video %s, unknown or non existent album.', 'wp-photo-album-plus'), basename( $file ) ) );
2188
  // Now the audio files
2189
  $audiocount = '0';
2190
  $alb = isset( $_POST['wppa-audio-album'] ) ? $_POST['wppa-audio-album'] : '0';
2191
+ // if ( wppa( 'ajax' ) && ! $alb ) {
2192
+ // wppa( 'ajax_import_files_error', __( 'Unknown album a', 'wp-photo-album-plus' ) );
2193
+ // }
2194
+ if ( $alb ) foreach ( array_keys( $files ) as $idx ) {
2195
  $file = $files[$idx];
2196
  if ( isset( $_POST['file-'.$idx] ) || wppa( 'ajax' ) ) {
2197
  if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files', wppa_sanitize_file_name( basename( $file ) ) );
2199
  if ( in_array( $ext, $wppa_supported_audio_extensions ) ) {
2200
  if ( is_numeric( $alb ) && $alb != '0' ) {
2201
 
2202
+ $the_file = array( 'name' => sanitize_file_name( basename( $file ) ),
2203
+ 'tmp_name' => $file,
2204
+ 'error' => 0,
2205
+ );
2206
+ if ( wppa_upload_one_item( $the_file, $alb, 'import' ) ) {
2207
+ if ( $delu ) {
2208
+ if ( wppa_is_file( $file ) ) {
2209
+ wppa_unlink( $file );
2210
+ }
2211
  }
2212
+ $audiocount++;
2213
  }
2214
+ }
2215
+ else {
2216
+ wppa_error_message( sprintf( __( 'Error inserting audio %s, unknown or non existent album.', 'wp-photo-album-plus'), basename( $file ) ) );
2217
+ }
2218
+ }
2219
+ }
2220
+ }
2221
 
2222
+ // Now the document files
2223
+ $documentcount = '0';
2224
+ $alb = isset( $_POST['wppa-document-album'] ) ? $_POST['wppa-document-album'] : '0';
2225
+ // if ( wppa( 'ajax' ) && ! $alb ) {
2226
+ // wppa( 'ajax_import_files_error', __( 'Unknown album d', 'wp-photo-album-plus' ) );
2227
+ // }
2228
+ if ( $alb ) foreach ( array_keys( $files ) as $idx ) {
2229
+ $file = $files[$idx];
2230
+ if ( isset( $_POST['file-'.$idx] ) || wppa( 'ajax' ) ) {
2231
+ if ( wppa( 'ajax' ) ) wppa( 'ajax_import_files', wppa_sanitize_file_name( basename( $file ) ) ); /* */
2232
+ $ext = strtolower( substr( strrchr( $file, "." ), 1 ) );
2233
+ if ( in_array( $ext, $wppa_supported_document_extensions ) ) {
2234
+ if ( is_numeric( $alb ) && $alb != '0' ) {
 
2235
 
2236
+ $the_file = array( 'name' => sanitize_file_name( basename( $file ) ),
2237
+ 'tmp_name' => $file,
2238
+ 'error' => 0,
2239
+ );
2240
+ if ( wppa_upload_one_item( $the_file, $alb, 'import' ) ) {
2241
+ if ( $deld ) {
2242
+ if ( wppa_is_file( $file ) ) {
2243
+ wppa_unlink( $file );
2244
+ }
2245
+ }
2246
+ $documentcount++;
2247
  }
 
 
 
 
 
 
2248
  }
2249
  else {
2250
+ wppa_error_message( sprintf( __( 'Error inserting document %s, unknown or non existent album.', 'wp-photo-album-plus'), basename( $file ) ) );
2251
  }
2252
  }
2253
  }
2751
 
2752
  wppa_ok_message( __( 'Done processing files.', 'wp-photo-album-plus') );
2753
 
2754
+ if ( $pcount == '0' && $acount == '0' && $zcount == '0' && $dircount == '0' && $photocount == '0' && $videocount == '0' && $audiocount == '0' && $csvcount == '0' && $documentcount == '0' ) {
2755
  wppa_warning_message( __( 'No files to import.', 'wp-photo-album-plus') );
2756
  }
2757
  else {
2776
  if ( $audiocount ) {
2777
  $msg .= $audiocount.' '.__( 'Audios imported.', 'wp-photo-album-plus' );
2778
  }
2779
+ if ( $documentcount ) {
2780
+ $msg .= $documentcount.' '.__( 'Documents imported.', 'wp-photo-album-plus' );
2781
+ }
2782
  if ( $csvcount ) {
2783
  $msg .= $csvcount . ' ' . __( 'CSVs imported,', 'wp-photo-album-plus') . ' ' .
2784
  $photos_processed_csv .' '. __( 'items processed.', 'wp-photo-album-plus' ) . ' ' .
2859
  return $result;
2860
  }
2861
 
2862
+ function wppa_get_documentcount( $files ) {
2863
+
2864
+ $result = 0;
2865
+ if ( ! wppa_switch( 'enable_pdf' ) ) {
2866
+ return 0;
2867
+ }
2868
+ if ( $files ) {
2869
+ foreach ( $files as $file ) {
2870
+ $ext = strtolower( wppa_get_ext( $file ) );
2871
+ if ( in_array( $ext, array( 'pdf', 'PDF' ) ) ) $result++;
2872
+ }
2873
+ }
2874
+ return $result;
2875
+ }
2876
+
2877
 
2878
  // Find dir is new album candidates
2879
  function wppa_get_dircount( $files ) {
2893
  $result = 0;
2894
  if ( $files ) {
2895
  foreach ( $files as $file ) {
2896
+ if ( strtolower( wppa_get_ext( $file ) ) == 'csv' ) $result++;
 
 
2897
  }
2898
  }
2899
  return $result;
wppa-upload-common.php CHANGED
@@ -8,7 +8,7 @@
8
  */
9
 
10
  // Upload a single item; an element form $_FILES
11
- // @1: Array( 'name' => the original filename with lowercase extension
12
  // 'tmp_name' => the path to the just uploaded file or a file somewhere else in the filesystem
13
  // 'error' => error code )
14
  // @2: Text: 'upload', 'front', 'import'
@@ -47,6 +47,8 @@ global $wppa_supported_document_extensions;
47
 
48
  // See if this filename (except extension) already exists in this album
49
  $ext_type = '';
 
 
50
  $ext_id = $wpdb->get_var( $wpdb->prepare( "SELECT id
51
  FROM $wpdb->wppa_photos
52
  WHERE filename LIKE %s
@@ -54,6 +56,8 @@ global $wppa_supported_document_extensions;
54
  $wpdb->esc_like( wppa_strip_ext( $file['name'] ) ) . '.%',
55
  $album
56
  ) );
 
 
57
  if ( $ext_id ) {
58
  $ext_ext = wppa_get_ext( wppa_get_photo_item( $ext_id, 'filename' ) );
59
  if ( wppa_is_video( $ext_id ) ) {
@@ -268,7 +272,7 @@ global $wppa_supported_document_extensions;
268
  $file_ext = @ strtolower( end( explode( '.', $stat['name'] ) ) );
269
 
270
  if ( in_array( $file_ext, $supp ) ) {
271
- $zip->extractTo( WPPA_DEPOT_PATH, $stat['name'] );
272
 
273
  // Find out if the file is ment for a sub(sub)album
274
  $p = $album;
@@ -299,7 +303,7 @@ global $wppa_supported_document_extensions;
299
  }
300
 
301
  // Recursively call wppa_upload_one_item()
302
- $zfile = array( 'tmp_name' => WPPA_DEPOT_PATH . '/' . $stat['name'],
303
  'name' => sanitize_file_name( basename( $stat['name'] ) ),
304
  'error' => 0,
305
  );
@@ -310,7 +314,7 @@ global $wppa_supported_document_extensions;
310
  else {
311
  $skip++;
312
  }
313
- wppa_unlink( WPPA_DEPOT_PATH . '/' . $stat['name'] );
314
  }
315
 
316
  // Assuming that entries without a file extension are directries. No warning on directory.
@@ -375,7 +379,12 @@ global $wppa_supported_document_extensions;
375
  if ( wppa_switch( 'enable_pdf' ) ) {
376
  $supp = array_merge( $supp, $wppa_supported_document_extensions );
377
  }
378
- if ( class_exists( 'ZipArchive' ) ) {
 
 
 
 
 
379
  array_push( $supp, 'zip' );
380
  }
381
  return $supp;
@@ -391,4 +400,48 @@ function wppa_upload_post_process( $the_type, $album, $id, $from ) {
391
  ) );
392
  wppa( 'is_pdf', false );
393
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
394
  }
8
  */
9
 
10
  // Upload a single item; an element form $_FILES
11
+ // @1: Array( 'name' => the original filename
12
  // 'tmp_name' => the path to the just uploaded file or a file somewhere else in the filesystem
13
  // 'error' => error code )
14
  // @2: Text: 'upload', 'front', 'import'
47
 
48
  // See if this filename (except extension) already exists in this album
49
  $ext_type = '';
50
+ $ext_id = wppa_is_file_alias( $file['name'], $album );
51
+ /*
52
  $ext_id = $wpdb->get_var( $wpdb->prepare( "SELECT id
53
  FROM $wpdb->wppa_photos
54
  WHERE filename LIKE %s
56
  $wpdb->esc_like( wppa_strip_ext( $file['name'] ) ) . '.%',
57
  $album
58
  ) );
59
+ */
60
+
61
  if ( $ext_id ) {
62
  $ext_ext = wppa_get_ext( wppa_get_photo_item( $ext_id, 'filename' ) );
63
  if ( wppa_is_video( $ext_id ) ) {
272
  $file_ext = @ strtolower( end( explode( '.', $stat['name'] ) ) );
273
 
274
  if ( in_array( $file_ext, $supp ) ) {
275
+ $zip->extractTo( WPPA_UPLOAD_PATH . '/temp/', $stat['name'] );
276
 
277
  // Find out if the file is ment for a sub(sub)album
278
  $p = $album;
303
  }
304
 
305
  // Recursively call wppa_upload_one_item()
306
+ $zfile = array( 'tmp_name' => WPPA_UPLOAD_PATH . '/temp/' . $stat['name'],
307
  'name' => sanitize_file_name( basename( $stat['name'] ) ),
308
  'error' => 0,
309
  );
314
  else {
315
  $skip++;
316
  }
317
+ wppa_unlink( WPPA_UPLOAD_PATH . '/temp/' . $stat['name'] );
318
  }
319
 
320
  // Assuming that entries without a file extension are directries. No warning on directory.
379
  if ( wppa_switch( 'enable_pdf' ) ) {
380
  $supp = array_merge( $supp, $wppa_supported_document_extensions );
381
  }
382
+ if ( class_exists( 'ZipArchive' ) &&
383
+ (
384
+ wppa_user_is( 'administrator' ) ||
385
+ ! wppa_switch( 'upload_one_only' )
386
+ )
387
+ ) {
388
  array_push( $supp, 'zip' );
389
  }
390
  return $supp;
400
  ) );
401
  wppa( 'is_pdf', false );
402
 
403
+ if ( $from == 'import' ) {
404
+ if ( wppa( 'ajax' ) ) {
405
+ wppa( 'ajax_import_files_done', true );
406
+ }
407
+ }
408
+ }
409
+
410
+ // To check on possible duplicate
411
+ // Returns the id if the given file is a photo and this photo is already in the given album as a photo
412
+ function wppa_is_file_duplicate_photo( $file, $album ) {
413
+ global $wppa_supported_photo_extensions;
414
+ global $wpdb;
415
+
416
+ if ( ! $file || ! $album ) return false;
417
+
418
+ $ext_id = wppa_is_file_alias( $file, $album );
419
+ if ( ! $ext_id ) return false;
420
+
421
+ $ext_ext = wppa_get_photo_item( $ext_id, 'ext' );
422
+ $new_ext = wppa_get_ext( basename( $file ) );
423
+
424
+ if ( in_array( $ext_ext, $wppa_supported_photo_extensions ) &&
425
+ in_array( $new_ext, $wppa_supported_photo_extensions ) ) {
426
+ return $ext_id;
427
+ }
428
+ else {
429
+ return false;
430
+ }
431
+ }
432
+
433
+ // To check for a possible poster or second filetype of existing item
434
+ // Returns the id if a given file with any extension already exists in the given album
435
+ function wppa_is_file_alias( $file, $album ) {
436
+ global $wpdb;
437
+
438
+ if ( ! $file ) return false; // Copy/move very old photo, before filnametracking
439
+ $id = $wpdb->get_var( $wpdb->prepare( "SELECT id
440
+ FROM $wpdb->wppa_photos
441
+ WHERE filename LIKE %s
442
+ AND album = %d",
443
+ $wpdb->esc_like( wppa_strip_ext( basename( $file ) ) ) . '.%',
444
+ $album
445
+ ) );
446
+ return $id;
447
  }
wppa-upload.php CHANGED
@@ -18,9 +18,8 @@ global $upload_album;
18
  // Maybe it helps...
19
  set_time_limit( 0 );
20
 
21
- // sanitize system
22
  $user = wppa_get_user();
23
- wppa_sanitize_files();
24
 
25
  // Sanitize album input
26
  if ( isset( $_POST['wppa-album'] ) ) {
@@ -92,39 +91,6 @@ global $upload_album;
92
  }
93
  }
94
 
95
- /*
96
- // From BOX B
97
- if ( isset( $_POST['wppa-upload'] ) ) {
98
- check_admin_referer( '$wppa_nonce', WPPA_NONCE );
99
- wppa_upload_photos();
100
- if ( isset( $_POST['wppa-go-edit-single'] ) ) {
101
- if ( current_user_can( 'wppa_admin' ) ) {
102
- wppa_ok_message( __( 'Connecting to edit album...' , 'wp-photo-album-plus' ) ); ?>
103
- <script type="text/javascript" >
104
- document.location = '<?php echo( wppa_dbg_url( get_admin_url().'admin.php?page=wppa_admin_menu&tab=edit&edit_id=' . $upload_album . '&wppa_nonce=' . wp_create_nonce( 'wppa_nonce', 'wppa_nonce' ), 'js' ) ) ?>';
105
- </script>
106
- <?php }
107
- elseif ( wppa_opt( 'upload_edit' ) != '-none-' ) {
108
- wppa_ok_message( __( 'Connecting to edit photos...' , 'wp-photo-album-plus' ) ); ?>
109
- <script type="text/javascript" >document.location = '<?php echo( wppa_dbg_url( get_admin_url().'admin.php?page=wppa_edit_photo', 'js' ) ) ?>';</script>
110
- <?php }
111
- }
112
- }
113
- // From BOX C
114
- if ( isset( $_POST['wppa-upload-zip'] ) ) {
115
- check_admin_referer( '$wppa_nonce', WPPA_NONCE );
116
- $err = wppa_upload_zip();
117
- if ( isset( $_POST['wppa-go-import'] ) && $err == '0' ) {
118
- wppa_ok_message( __( 'Connecting to your depot...' , 'wp-photo-album-plus' ) );
119
- update_option( 'wppa_import_source_'.$user, WPPA_DEPOT_PATH ); ?>
120
- <script type="text/javascript" >document.location = '<?php echo( wppa_dbg_url( get_admin_url().'admin.php?page=wppa_import_photos&zip='.$target, 'js' ) ) ?>';</script>
121
- <?php }
122
- }
123
- */
124
- // sanitize system again
125
- wppa_sanitize_files();
126
-
127
-
128
  // Open the form
129
  echo
130
  '<div class="wrap">' .
@@ -178,76 +144,20 @@ global $upload_album;
178
  }
179
  }
180
 
181
- // Upload One only configured and not administrator or super user?
182
- if ( wppa_switch( 'upload_one_only' ) && ! wppa_user_is( 'administrator' ) ) {
183
-
184
- // One only
185
- echo
186
- '<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px; width: 600px;">' .
187
- '<h3 style="margin-top:0px;">' . __( 'Upload a single photo' , 'wp-photo-album-plus' ) . '</h3>' .
188
- '<form enctype="multipart/form-data" action="' . wppa_dbg_url( get_admin_url() . 'admin.php?page=wppa_upload_photos' ) . '" method="post">' .
189
- wp_nonce_field( '$wppa_nonce', WPPA_NONCE ) .
190
- '<input id="my_files" type="file" name="my_files[]" />' .
191
- '<p>' .
192
- '<label for="wppa-album">' .
193
- __( 'Album:' , 'wp-photo-album-plus') .
194
- '</label>' .
195
- wppa_album_select_a( array( 'path' => wppa_switch( 'hier_albsel' ),
196
- 'addpleaseselect' => true,
197
- 'checkowner' => true,
198
- 'checkupload' => true,
199
- 'sort' => true,
200
- 'tagopen' => '<select name="wppa-album" id="wppa-album-s" style="max-width:100%;" >',
201
- 'tagid' => 'wppa-album-s',
202
- 'tagname' => 'wppa-album',
203
- 'tagstyle' => 'max-width:100%;',
204
- ) ) .
205
- '</p>';
206
- if ( wppa_switch( 'watermark_on' ) && ( wppa_switch( 'watermark_user' ) || current_user_can( 'wppa_settings' ) ) ) {
207
- echo
208
- '<p>' .
209
- __( 'Apply watermark file:' , 'wp-photo-album-plus' ) .
210
- '<select name="wppa-watermark-file" id="wppa-watermark-file" >' .
211
- wppa_watermark_file_select( 'user' ) .
212
- '</select>' .
213
- __( 'Position:' , 'wp-photo-album-plus' ) .
214
- '<select name="wppa-watermark-pos" id="wppa-watermark-pos" >' .
215
- wppa_watermark_pos_select( 'user' ) .
216
- '</select>' .
217
- '</p>';
218
- }
219
- echo
220
- '<input' .
221
- ' type="submit" class="button-primary"' .
222
- ' name="wppa-upload-multiple"' .
223
- ' value="' . __( 'Upload Photo' , 'wp-photo-album-plus') . '"' .
224
- ' onclick="if ( document.getElementById( \'wppa-album-s\' ).value == 0 ) { alert( \'' . __( 'Please select an album' , 'wp-photo-album-plus' ) . '\' ); return false; }"' .
225
- ' />' .
226
- '<input type="checkbox"' .
227
- ' id="wppa-go-edit-multiple"' .
228
- ' name="wppa-go-edit-multiple"' .
229
- ' style="display:none"' .
230
- ' checked="checked"' .
231
- ' />' .
232
- '</form>' .
233
- '</div>';
234
- }
235
-
236
- // Upload multiple allowed
237
- else {
238
-
239
- // The information box
240
- echo
241
- '<div' .
242
- ' style="' .
243
- 'border:1px solid #ccc;' .
244
- 'padding:10px;' .
245
- 'margin-bottom:10px;' .
246
- 'width:600px;' .
247
- 'background-color:#fffbcc;' .
248
- 'border-color:#e6db55;' .
249
- '"' .
250
- ' >' .
251
  sprintf( __( '<b>Notice:</b> your server allows you to upload <b>%s</b> files of maximum <b>%s</b> bytes each and total <b>%s</b> bytes and allows <b>%s</b> seconds to complete.' , 'wp-photo-album-plus' ), $max_files_txt, $max_size, $max_tot_size, $max_time ) .
252
  ' ' .
253
  __( 'If your request exceeds these limitations, it will fail, probably without an errormessage.' , 'wp-photo-album-plus' ) .
@@ -256,302 +166,179 @@ global $upload_album;
256
  '<br />' .
257
  wppa_check_memory_limit() .
258
  '</div>';
 
259
 
260
- // Box A: Upload Multple photos
261
- echo
262
- '<div
263
- style="
264
- border:1px solid #ccc;
265
- padding:10px;
266
- margin-bottom:10px;
267
- width: 600px;
268
- "
269
- >
270
- <h3 style="margin-top:0px;">' .
271
- __( 'Multiple file in one selection' , 'wp-photo-album-plus' ) . '
272
- </h3>' .
273
- sprintf( __( 'You can select up to %s files in one selection and upload them.' , 'wp-photo-album-plus' ), $max_files_txt ) . '
274
- <br />' .
275
- __( 'Supported filetypes are', 'wp-photo-album-plus' ) . ': ' . implode( ', ', wppa_get_supported_extensions() ) . '
276
- <br />
277
- <small style="color:blue" >' .
 
 
 
 
 
 
278
  __( 'You need a modern browser that supports HTML-5 to select multiple files' , 'wp-photo-album-plus') . '
279
- </small>
280
- <form
281
- enctype="multipart/form-data"
282
- action="' . wppa_dbg_url( get_admin_url() . 'admin.php?page=wppa_upload_photos' ) . '"
283
- method="post"
284
- >' .
285
- wp_nonce_field( '$wppa_nonce', WPPA_NONCE, true, false ) . '
286
- <input
287
- id="my_files"
288
- type="file"
289
- multiple="multiple"
290
- name="my_files[]"
291
- onchange="showit()"
292
- />
293
- <div id="files_list2" >
294
- <h3>' .
295
- __( 'Selected Files:' , 'wp-photo-album-plus' ) . '
296
- </h3>
297
- </div>
298
- <script type="text/javascript" >' .
299
- 'function showit() {' .
300
- 'var maxsize = parseInt( \'' . $max_tot_size_mbytes . '\' ) * 1024 * 1024;' .
301
- 'var maxcount = parseInt( \'' . $max_files_txt . '\' );' .
302
- 'var totsize = 0;' .
303
- 'var files = document.getElementById( \'my_files\' ).files;' .
304
- 'var tekst = "<h3>' . __( 'Selected Files:' , 'wp-photo-album-plus' ) . '</h3>";' .
305
- 'tekst += "<table><thead><tr>";' .
306
- 'tekst += "<td>' . __( 'Name' , 'wp-photo-album-plus' ) . '</td>";' .
307
- 'tekst += "<td>' . __( 'Size' , 'wp-photo-album-plus' ) . '</td>";' .
308
- 'tekst += "<td>' . __( 'Type' , 'wp-photo-album-plus' ) . '</td>";' .
309
- 'tekst += "</tr></thead>";' .
310
- 'tekst += "<tbody>";' .
311
- 'tekst += "<tr><td><hr /></td><td><hr /></td><td><hr /></td></tr>";' .
312
- 'for ( var i=0;i<files.length;i++ ) {' .
313
- 'tekst += "<tr>";' .
314
- 'tekst += "<td>" + files[i].name + "</td>";' .
315
- 'tekst += "<td id=\'file"+i+"size\' >" + files[i].size + "</td>";' .
316
- 'totsize += files[i].size;' .
317
- 'tekst += "<td>" + ( files[i].size > ' . $max_size_bytes . ' ? "<span style=\'color:red\' >' . __( 'Too big!' , 'wp-photo-album-plus') . '</span>" : files[i].type ) + "</td>";' .
318
- 'tekst += "</tr>";' .
319
- '}' .
320
- 'tekst += "<tr><td><hr /></td><td><hr /></td><td><hr /></td></tr>";' .
321
- 'var style1 = "";' .
322
- 'var style2 = "";' .
323
- 'var style3 = "";' .
324
- 'var warn1 = "";' .
325
- 'var warn2 = "";' .
326
- 'var warn3 = "";' .
327
- 'if ( maxcount > 0 && files.length > maxcount ) {' .
328
- 'style1 = "color:red";' .
329
- 'warn1 = "' . __( 'Too many!' , 'wp-photo-album-plus' ) . '";' .
330
- '}' .
331
- 'if ( maxsize > 0 && totsize > maxsize ) {' .
332
- 'style2 = "color:red";' .
333
- 'warn2 = "' . __( 'Too big!' , 'wp-photo-album-plus') . '";' .
334
- '}' .
335
- 'if ( warn1 || warn2 ) {' .
336
- 'style3 = "color:green";' .
337
- 'warn3 = "' . __( 'Try again!' , 'wp-photo-album-plus' ) . '";' .
338
  '}' .
339
- 'tekst += "<tr><td style="+style1+" >' . __( 'Total' , 'wp-photo-album-plus' ) . ': "+files.length+" "+warn1+"</td><td style="+style2+" >"+totsize+" "+warn2+"</td><td style="+style3+" >"+warn3+"</td></tr>";' .
340
- 'tekst += "</tbody>";' .
341
- 'tekst += "</table>";' .
342
- 'jQuery( "#files_list2" ).html( tekst );' .
343
- '}' .
344
- '</script>' .
345
- '<p>' .
346
- '<label for="wppa-album">' . __( 'Album:' , 'wp-photo-album-plus' ) . '</label>' .
347
- wppa_album_select_a( array( 'path' => wppa_switch( 'hier_albsel' ),
348
- 'addpleaseselect' => true,
349
- 'checkowner' => true,
350
- 'checkupload' => true,
351
- 'sort' => true,
352
- 'tagopen' => '<select name="wppa-album" id="wppa-album-s" style="max-width:100%;" >',
353
- 'tagid' => 'wppa-album-s',
354
- 'tagname' => 'wppa-album',
355
- 'tagstyle' => 'max-width:100%;',
356
- ) ) .
357
- '</p>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
358
 
359
- // Watermark?
360
- if ( wppa_switch( 'watermark_on' ) && ( wppa_switch( 'watermark_user' ) || current_user_can( 'wppa_settings' ) ) ) {
361
- echo
362
- '<p>' .
363
- __( 'Apply watermark file:' , 'wp-photo-album-plus' ) .
364
- '<select name="wppa-watermark-file" id="wppa-watermark-file" >' .
365
- wppa_watermark_file_select( 'user' ) .
366
- '</select>' .
367
- __( 'Position:' , 'wp-photo-album-plus' ) .
368
- '<select name="wppa-watermark-pos" id="wppa-watermark-pos" >' .
369
- wppa_watermark_pos_select( 'user' ) .
370
- '</select>' .
371
- '</p>';
372
- }
373
-
374
- // Submit section
375
  echo
376
- '<input' .
377
- ' type="submit"' .
378
- ' class="button-primary"' .
379
- ' name="wppa-upload-multiple"' .
380
- ' value="' . __( 'Upload Multiple Photos', 'wp-photo-album-plus' ) . '"' .
381
- ' onclick="if ( document.getElementById( \'wppa-album-s\' ).value == 0 ) { alert( \'' . __( 'Please select an album' , 'wp-photo-album-plus' ) . '\' ); return false; }"' .
382
- ' />' .
383
- ' ';
384
- if ( current_user_can( 'wppa_admin' ) || wppa_opt( 'upload_edit' ) != 'none' ) {
385
- echo
386
- '<input' .
387
- ' type="checkbox"' .
388
- ' id="wppa-go-edit-multiple"' .
389
- ' name="wppa-go-edit-multiple"' .
390
- ' onchange="wppaCookieCheckbox( this, \'wppa-go-edit-multiple\' )"' .
391
- ' />' .
392
- '<script type="text/javascript" >' .
393
- 'if ( wppa_getCookie( \'wppa-go-edit-multiple\' ) == \'on\' ) document.getElementById( \'wppa-go-edit-multiple\' ).checked = \'checked\';' .
394
- '</script>';
395
- }
396
-
397
- if ( current_user_can( 'wppa_admin' ) ) {
398
- _e( 'After upload: Go to the <b>Edit Album</b> page.', 'wp-photo-album-plus');
399
- }
400
- elseif ( wppa_opt( 'upload_edit' ) != 'none' ) {
401
- _e( 'After upload: Go to the <b>Edit Photos</b> page.', 'wp-photo-album-plus');
402
- }
403
- echo
404
- '</form>' .
405
- '</div>';
406
- // End BOX A
407
- /*
408
- // Box B: Single photos
409
- echo
410
- '<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px; width: 600px;" >' .
411
- '<h3 style="margin-top:0px;" >' .
412
- __( 'Box B:' , 'wp-photo-album-plus') . ' ' . __( 'Single Photos in multiple selections' , 'wp-photo-album-plus') .
413
- '</h3>' .
414
- sprintf( __( 'You can select up to %s photos one by one and upload them at once.' , 'wp-photo-album-plus'), $max_files_txt ) .
415
- '<form' .
416
- ' enctype="multipart/form-data"' .
417
- ' action="' . wppa_dbg_url( get_admin_url().'admin.php?page=wppa_upload_photos' ) . '"' .
418
- ' method="post" ' .
419
- ' >' .
420
- wp_nonce_field( '$wppa_nonce', WPPA_NONCE, true, false ) .
421
- '<input' .
422
- ' id="my_file_element"' .
423
- ' type="file"' .
424
- ' name="file_1"' .
425
- '/>' .
426
- '<div id="files_list">' .
427
- '<h3>' . __( 'Selected Files:' , 'wp-photo-album-plus') . '</h3>' .
428
- '</div>' .
429
  '<p>' .
430
- '<label for="wppa-album">' . __( 'Album:' , 'wp-photo-album-plus') . '</label>' .
431
- wppa_album_select_a( array( 'path' => wppa_switch( 'hier_albsel' ),
432
- 'addpleaseselect' => true,
433
- 'checkowner' => true,
434
- 'checkupload' => true,
435
- 'sort' => true,
436
- 'tagopen' => '<select name="wppa-album" id="wppa-album-m" style="max-width:100%;" >',
437
- 'tagid' => 'wppa-album-m',
438
- 'tagname' => 'wppa-album',
439
- 'tagstyle' => 'max-width:100%;',
440
- ) ) .
441
  '</p>';
 
442
 
443
- // Watermark?
444
- if ( wppa_switch( 'watermark_on' ) && ( wppa_switch( 'watermark_user' ) || current_user_can( 'wppa_settings' ) ) ) {
445
- echo
446
- '<p>' .
447
- __( 'Apply watermark file:' , 'wp-photo-album-plus' ) .
448
- '<select name="wppa-watermark-file" id="wppa-watermark-file" >' .
449
- wppa_watermark_file_select( 'user' ) .
450
- '</select>' .
451
- __( 'Position:' , 'wp-photo-album-plus' ) .
452
- '<select name="wppa-watermark-pos" id="wppa-watermark-pos" >' .
453
- wppa_watermark_pos_select( 'user' ) .
454
- '</select>' .
455
- '</p>';
456
- }
457
-
458
- // Submit section
459
  echo
460
  '<input' .
461
- ' type="submit"' .
462
- ' class="button-primary"' .
463
- ' name="wppa-upload"' .
464
- ' value="' . __( 'Upload Single Photos' , 'wp-photo-album-plus') . '"' .
465
- ' onclick="if ( document.getElementById( \'wppa-album-m\' ).value == 0 ) { alert( \'' . __( 'Please select an album' , 'wp-photo-album-plus' ) . '\' ); return false; }"' .
466
  ' />' .
467
- ' ';
468
- if ( current_user_can( 'wppa_admin' ) || wppa_opt( 'upload_edit' ) != 'none' ) {
469
- echo
470
- '<input' .
471
- ' type="checkbox"' .
472
- ' id="wppa-go-edit-single"' .
473
- ' name="wppa-go-edit-single"' .
474
- ' onchange="wppaCookieCheckbox( this, \'wppa-go-edit-single\' )" />' .
475
- '<script type="text/javascript" >' .
476
- 'if ( wppa_getCookie( \'wppa-go-edit-single\' ) == \'on\' ) document.getElementById( \'wppa-go-edit-single\' ).checked = \'checked\';' .
477
- '</script>';
478
- }
479
-
480
- if ( current_user_can( 'wppa_admin' ) ) {
481
- _e( 'After upload: Go to the <b>Edit Album</b> page.' , 'wp-photo-album-plus');
482
- }
483
- elseif ( wppa_opt( 'upload_edit' ) != 'none' ) {
484
- _e( 'After upload: Go to the <b>Edit Photos</b> page.' , 'wp-photo-album-plus');
485
- }
486
- echo
487
- '</form>' .
488
- '<script type="text/javascript" >' .
489
- // '<!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->' .
490
- 'var multi_selector = new MultiSelector( document.getElementById( \'files_list\' ), ' . $max_files . ');' .
491
- // '<!-- Pass in the file element -->' .
492
- 'multi_selector.addElement( document.getElementById( \'my_file_element\' ) );' .
493
- '</script>' .
494
- '</div>';
495
- // End Box B
496
 
497
- // Box C: Single zips, useless if user can not imort, or when php <50207: no unzip
498
- if ( current_user_can( 'wppa_import' ) ) {
499
- if ( PHP_VERSION_ID >= 50207 ) {
500
- echo
501
- '<div style="border:1px solid #ccc; padding:10px; width: 600px;" >' .
502
- '<h3 style="margin-top:0px;" >' .
503
- __( 'Box C:' , 'wp-photo-album-plus') . ' ' . __( 'Zipped Photos in one selection' , 'wp-photo-album-plus') .
504
- '</h3>' .
505
- sprintf( __( 'You can upload one zipfile. It will be placed in your personal wppa-depot: <b>.../%s</b><br/>Once uploaded, use <b>Import Photos</b> to unzip the file and place the photos in any album.' , 'wp-photo-album-plus'), WPPA_DEPOT ) .
506
- '<form' .
507
- ' enctype="multipart/form-data"' .
508
- ' action="' . wppa_dbg_url( get_admin_url() . 'admin.php?page=wppa_upload_photos' ) . '"' .
509
- ' method="post"' .
510
- ' >' .
511
- wp_nonce_field( '$wppa_nonce', WPPA_NONCE, true, false ) .
512
- '<input' .
513
- ' id="my_zipfile_element"' .
514
- ' type="file"' .
515
- ' name="file_zip"' .
516
- ' />' .
517
- '<br/><br/>' .
518
- '<input' .
519
- ' type="submit"' .
520
- ' class="button-primary"' .
521
- ' name="wppa-upload-zip"' .
522
- ' value="' . __( 'Upload Zipped Photos' , 'wp-photo-album-plus') . '"' .
523
- ' />' .
524
- ' ' .
525
- '<input' .
526
- ' type="checkbox"' .
527
- ' id="wppa-go-import"' .
528
- ' name="wppa-go-import"' .
529
- ' onchange="wppaCookieCheckbox( this, \'wppa-go-import\' )"' .
530
- ' />' .
531
- '<script type="text/javascript" >' .
532
- 'if ( wppa_getCookie( \'wppa-go-import\' ) == \'on\' ) document.getElementById( \'wppa-go-import\' ).checked = \'checked\';' .
533
- '</script>' .
534
- __( 'After upload: Go to the <b>Import Photos</b> page.' , 'wp-photo-album-plus') .
535
- '</form>' .
536
- '</div>';
537
  }
538
- else {
539
- echo
540
- '<div style="border:1px solid #ccc; padding:10px; width: 600px;">' .
541
- '<small>' .
542
- __( 'Ask your administrator to upgrade php to version 5.2.7 or later. This will enable you to upload zipped photos.' , 'wp-photo-album-plus') .
543
- '</small>' .
544
- '</div>';
545
  }
546
- }
547
- */
548
- }
549
-
550
- echo
551
- '</div>';
552
  }
553
 
554
- // Upload multiple photos Box A
555
  function wppa_upload_multiple() {
556
  global $warning_given;
557
  global $upload_album;
@@ -560,6 +347,7 @@ global $upload_album;
560
  $uploaded_a_file = false;
561
 
562
  $count = '0';
 
563
  foreach( $_FILES as $the_file ) { // Usually only one item: $_FILES['my_file']
564
  for ( $i = '0'; $i < count( $the_file['error'] ); $i++ ) {
565
 
@@ -572,6 +360,9 @@ global $upload_album;
572
 
573
  if ( wppa_upload_one_item( $file, $upload_album, 'upload' ) ) {
574
  $count++;
 
 
 
575
  }
576
 
577
  if ( wppa_is_time_up() ) {
@@ -583,83 +374,11 @@ global $upload_album;
583
  }
584
 
585
  if ( $count ) {
586
- wppa_update_message( $count.' '.__( 'files uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
587
- wppa_set_last_album( $upload_album );
588
- }
589
- }
590
-
591
- // Upload single photos Box B
592
- function wppa_upload_photos() {
593
- global $warning_given;
594
- global $upload_album;
595
-
596
- $warning_given = false;
597
-
598
- $count = '0';
599
- foreach ( $_FILES as $file ) {
600
-
601
- if ( $file['name'] ) {
602
- if ( wppa_upload_one_item( $file, $upload_album, 'upload' ) ) {
603
- $count++;
604
- }
605
- }
606
-
607
- if ( wppa_is_time_up() ) {
608
- wppa_warning_message( sprintf( __( 'Time out. %s files uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
609
- wppa_set_last_album( $upload_album );
610
- return;
611
- }
612
- }
613
-
614
- if ( $count ) {
615
- wppa_update_message( $count.' '.__( 'files uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
616
  wppa_set_last_album( $upload_album );
617
  }
618
  }
619
 
620
- // Send emails after backend upload
621
- function wppa_backend_upload_mail( $id, $alb, $name ) {
622
- return;
623
- $owner = wppa_get_user();
624
- if ( $owner == 'admin' ) return; // Admin does not send mails to himself
625
-
626
- if ( wppa_switch( 'upload_backend_notify' ) ) {
627
- $to = get_bloginfo( 'admin_email' );
628
- $subj = sprintf( __( 'New photo uploaded: %s' , 'wp-photo-album-plus'), wppa_sanitize_file_name( $name ) );
629
- $cont['0'] = sprintf( __( 'User %1$s uploaded photo %2$s into album %3$s' , 'wp-photo-album-plus'), $owner, $id, wppa_get_album_name( $alb ) );
630
- if ( wppa_switch( 'upload_moderate' ) && !current_user_can( 'wppa_admin' ) ) {
631
- $cont['1'] = __( 'This upload requires moderation' , 'wp-photo-album-plus');
632
- $cont['2'] = '<a href="'.get_admin_url().'admin.php?page=wppa_admin_menu&tab=pmod&photo='.$id.'" >'.__( 'Moderate manage photo' , 'wp-photo-album-plus').'</a>';
633
- }
634
- else {
635
- $cont['1'] = __( 'Details:' , 'wp-photo-album-plus');
636
- $cont['1'] .= ' <a href="'.get_admin_url().'admin.php?page=wppa_admin_menu&tab=pmod&photo='.$id.'" >'.__( 'Manage photo' , 'wp-photo-album-plus').'</a>';
637
- }
638
- wppa_send_mail( array( 'to' => $to,
639
- 'subj' => $subj,
640
- 'cont' => $cont,
641
- 'photo' => $id,
642
- 'listtype' => 'uploadbackend',
643
- ));
644
- }
645
- }
646
-
647
- // Upload a zipfile
648
- function wppa_upload_zip() {
649
- global $target;
650
-
651
- $file = $_FILES['file_zip'];
652
- $name = wppa_sanitize_file_name( $file['name'] );
653
- $type = $file['type'];
654
- $error = $file['error'];
655
- $size = $file['size'];
656
- $temp = $file['tmp_name'];
657
- $target = WPPA_DEPOT_PATH.'/'.$name;
658
-
659
- wppa_copy( $temp, $target );
660
-
661
- if ( $error == '0' ) wppa_ok_message( __( 'Zipfile' , 'wp-photo-album-plus').' '.$name.' '.__( 'sucessfully uploaded.' , 'wp-photo-album-plus') );
662
- else wppa_error_message( __( 'Error' , 'wp-photo-album-plus').' '.$error.' '.__( 'during upload.' , 'wp-photo-album-plus') );
663
-
664
- return $error;
665
- }
18
  // Maybe it helps...
19
  set_time_limit( 0 );
20
 
21
+ // Who am I?
22
  $user = wppa_get_user();
 
23
 
24
  // Sanitize album input
25
  if ( isset( $_POST['wppa-album'] ) ) {
91
  }
92
  }
93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
  // Open the form
95
  echo
96
  '<div class="wrap">' .
144
  }
145
  }
146
 
147
+ // The information box
148
+ $multi = wppa_user_is( 'administrator' ) || ! wppa_switch( 'upload_one_only' );
149
+ if ( $multi ) {
150
+ echo '
151
+ <div
152
+ style="
153
+ border:1px solid #ccc;
154
+ padding:10px;
155
+ margin-bottom:10px;
156
+ width:600px;
157
+ background-color:#fffbcc;
158
+ border-color:#e6db55;
159
+ "
160
+ >' .
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  sprintf( __( '<b>Notice:</b> your server allows you to upload <b>%s</b> files of maximum <b>%s</b> bytes each and total <b>%s</b> bytes and allows <b>%s</b> seconds to complete.' , 'wp-photo-album-plus' ), $max_files_txt, $max_size, $max_tot_size, $max_time ) .
162
  ' ' .
163
  __( 'If your request exceeds these limitations, it will fail, probably without an errormessage.' , 'wp-photo-album-plus' ) .
166
  '<br />' .
167
  wppa_check_memory_limit() .
168
  '</div>';
169
+ }
170
 
171
+ // The Upload box
172
+ echo '
173
+ <div
174
+ style="
175
+ border:1px solid #ccc;
176
+ padding:10px;
177
+ margin-bottom:10px;
178
+ width: 600px;
179
+ "
180
+ >
181
+ <h3 style="margin-top:0px;">' .
182
+ ( $multi ?
183
+ __( 'Select Multiple files' , 'wp-photo-album-plus' ) :
184
+ __( 'Select one file', 'wp-photo-album-plus' )
185
+ ) . '
186
+ </h3>' .
187
+ ( $multi ?
188
+ sprintf( __( 'You can select up to %s files in one selection and upload them.' , 'wp-photo-album-plus' ), $max_files_txt ) .'<br />' :
189
+ ''
190
+ ) .
191
+ __( 'Supported filetypes are', 'wp-photo-album-plus' ) . ': ' . implode( ', ', wppa_get_supported_extensions() ) . '
192
+ <br />' .
193
+ ( $multi ?
194
+ '<small style="color:blue" >' .
195
  __( 'You need a modern browser that supports HTML-5 to select multiple files' , 'wp-photo-album-plus') . '
196
+ </small>' :
197
+ ''
198
+ ) . '
199
+ <form
200
+ enctype="multipart/form-data"
201
+ action="' . wppa_dbg_url( get_admin_url() . 'admin.php?page=wppa_upload_photos' ) . '"
202
+ method="post"
203
+ >' .
204
+ wp_nonce_field( '$wppa_nonce', WPPA_NONCE, true, false ) . '
205
+ <input
206
+ id="my_files"
207
+ type="file" ' .
208
+ ( $multi ? 'multiple="multiple" ' : '' ) . '
209
+ name="my_files[]"
210
+ onchange="showit()"
211
+ />
212
+ <div id="files_list2" >
213
+ <h3>' .
214
+ ( $multi ?
215
+ __( 'Selected Files:' , 'wp-photo-album-plus' ) :
216
+ __( 'Selected File:' , 'wp-photo-album-plus' )
217
+ ) . '
218
+ </h3>
219
+ </div>
220
+ <script type="text/javascript" >
221
+ function showit() {
222
+ var canUpload = true;
223
+ var maxsize = parseInt( \'' . $max_tot_size_mbytes . '\' ) * 1024 * 1024;' .
224
+ 'var maxcount = parseInt( \'' . $max_files_txt . '\' );' .
225
+ 'var totsize = 0;' .
226
+ 'var files = document.getElementById( \'my_files\' ).files;' .
227
+ 'var tekst = "<h3>' . __( 'Selected Files:' , 'wp-photo-album-plus' ) . '</h3>";' .
228
+ 'tekst += "<table><thead><tr>";' .
229
+ 'tekst += "<td>' . __( 'Name' , 'wp-photo-album-plus' ) . '</td>";' .
230
+ 'tekst += "<td>' . __( 'Size' , 'wp-photo-album-plus' ) . '</td>";' .
231
+ 'tekst += "<td>' . __( 'Type' , 'wp-photo-album-plus' ) . '</td>";' .
232
+ 'tekst += "</tr></thead>";' .
233
+ 'tekst += "<tbody>";' .
234
+ 'tekst += "<tr><td><hr /></td><td><hr /></td><td><hr /></td></tr>";' .
235
+ 'for ( var i=0;i<files.length;i++ ) {' .
236
+ 'tekst += "<tr>";' .
237
+ 'tekst += "<td>" + files[i].name + "</td>";' .
238
+ 'tekst += "<td id=\'file"+i+"size\' >" + files[i].size + "</td>";' .
239
+ 'totsize += files[i].size;' .
240
+ 'tekst += "<td>" + ( files[i].size > ' . $max_size_bytes . ' ? "<span style=\'color:red\' >' . __( 'Too big!' , 'wp-photo-album-plus') . '</span>" : files[i].type ) + "</td>";' .
241
+ 'tekst += "</tr>";' .
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  '}' .
243
+ 'tekst += "<tr><td><hr /></td><td><hr /></td><td><hr /></td></tr>";' .
244
+ 'var style1 = "";' .
245
+ 'var style2 = "";' .
246
+ 'var style3 = "";' .
247
+ 'var warn1 = "";' .
248
+ 'var warn2 = "";' .
249
+ 'var warn3 = "";' .
250
+ 'if ( maxcount > 0 && files.length > maxcount ) {' .
251
+ 'style1 = "color:red";' .
252
+ 'warn1 = "' . __( 'Too many!' , 'wp-photo-album-plus' ) . '";
253
+ }' .
254
+ 'if ( maxsize > 0 && totsize > maxsize ) {' .
255
+ 'style2 = "color:red";' .
256
+ 'warn2 = "' . __( 'Too big!' , 'wp-photo-album-plus') . '";' .
257
+ '}' .
258
+ 'if ( warn1 || warn2 ) {' .
259
+ 'style3 = "color:green";' .
260
+ 'warn3 = "' . __( 'Try again!' , 'wp-photo-album-plus' ) . '";
261
+ canUpload = false;
262
+ }' .
263
+ 'tekst += "<tr><td style="+style1+" >' . __( 'Total' , 'wp-photo-album-plus' ) . ': "+files.length+" "+warn1+"</td><td style="+style2+" >"+totsize+" "+warn2+"</td><td style="+style3+" >"+warn3+"</td></tr>";' .
264
+ 'tekst += "</tbody>";' .
265
+ 'tekst += "</table>";' .
266
+ 'jQuery( "#files_list2" ).html( tekst );
267
+ if ( canUpload ) {
268
+ jQuery( "#wppa-upload-submit" ).removeProp( "disabled" );
269
+ }
270
+ else {
271
+ jQuery( "#wppa-upload-submit" ).prop( "disabled" );
272
+ }
273
+ }' .
274
+ '</script>' .
275
+ '<p>' .
276
+ '<label for="wppa-album">' . __( 'Album:' , 'wp-photo-album-plus' ) . '</label>' .
277
+ wppa_album_select_a( array( 'path' => wppa_switch( 'hier_albsel' ),
278
+ 'addpleaseselect' => true,
279
+ 'checkowner' => true,
280
+ 'checkupload' => true,
281
+ 'sort' => true,
282
+ 'tagopen' => '<select name="wppa-album" id="wppa-album-s" style="max-width:100%;" >',
283
+ 'tagid' => 'wppa-album-s',
284
+ 'tagname' => 'wppa-album',
285
+ 'tagstyle' => 'max-width:100%;',
286
+ ) ) .
287
+ '</p>';
288
 
289
+ // Watermark?
290
+ if ( wppa_switch( 'watermark_on' ) && ( wppa_switch( 'watermark_user' ) || current_user_can( 'wppa_settings' ) ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  echo
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
292
  '<p>' .
293
+ __( 'Apply watermark file:' , 'wp-photo-album-plus' ) .
294
+ '<select name="wppa-watermark-file" id="wppa-watermark-file" >' .
295
+ wppa_watermark_file_select( 'user' ) .
296
+ '</select>' .
297
+ __( 'Position:' , 'wp-photo-album-plus' ) .
298
+ '<select name="wppa-watermark-pos" id="wppa-watermark-pos" >' .
299
+ wppa_watermark_pos_select( 'user' ) .
300
+ '</select>' .
 
 
 
301
  '</p>';
302
+ }
303
 
304
+ // Submit section
305
+ echo '
306
+ <input
307
+ id="wppa-upload-submit"
308
+ type="submit"
309
+ class="button-primary"
310
+ name="wppa-upload-multiple"
311
+ disabled="disabled"
312
+ value="' . __( 'Upload now', 'wp-photo-album-plus' ) . '"
313
+ onclick="if ( document.getElementById( \'wppa-album-s\' ).value == 0 ) { alert( \'' . __( 'Please select an album' , 'wp-photo-album-plus' ) . '\' ); return false; }"
314
+ />' .
315
+ ' ';
316
+ if ( current_user_can( 'wppa_admin' ) || wppa_opt( 'upload_edit' ) != 'none' ) {
 
 
 
317
  echo
318
  '<input' .
319
+ ' type="checkbox"' .
320
+ ' id="wppa-go-edit-multiple"' .
321
+ ' name="wppa-go-edit-multiple"' .
322
+ ' onchange="wppaCookieCheckbox( this, \'wppa-go-edit-multiple\' )"' .
 
323
  ' />' .
324
+ '<script type="text/javascript" >' .
325
+ 'if ( wppa_getCookie( \'wppa-go-edit-multiple\' ) == \'on\' ) document.getElementById( \'wppa-go-edit-multiple\' ).checked = \'checked\';' .
326
+ '</script>';
327
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
328
 
329
+ if ( current_user_can( 'wppa_admin' ) ) {
330
+ _e( 'After upload: Go to the <b>Edit Album</b> page.', 'wp-photo-album-plus');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
331
  }
332
+ elseif ( wppa_opt( 'upload_edit' ) != 'none' ) {
333
+ _e( 'After upload: Go to the <b>Edit Photos</b> page.', 'wp-photo-album-plus');
 
 
 
 
 
334
  }
335
+ echo '
336
+ </form>
337
+ </div>
338
+ </div>';
 
 
339
  }
340
 
341
+ // Upload multiple photos
342
  function wppa_upload_multiple() {
343
  global $warning_given;
344
  global $upload_album;
347
  $uploaded_a_file = false;
348
 
349
  $count = '0';
350
+ $any_zip = false;
351
  foreach( $_FILES as $the_file ) { // Usually only one item: $_FILES['my_file']
352
  for ( $i = '0'; $i < count( $the_file['error'] ); $i++ ) {
353
 
360
 
361
  if ( wppa_upload_one_item( $file, $upload_album, 'upload' ) ) {
362
  $count++;
363
+ if ( 'zip' == strtolower( wppa_get_ext( $the_file['name'][$i] ) ) ) {
364
+ $any_zip = true;
365
+ }
366
  }
367
 
368
  if ( wppa_is_time_up() ) {
374
  }
375
 
376
  if ( $count ) {
377
+ wppa_update_message( $count . ' ' . ( $any_zip ?
378
+ __( 'files processed for album nr', 'wp-photo-album-plus' ) :
379
+ __( 'files uploaded in album nr' , 'wp-photo-album-plus' )
380
+ ) . ' ' . $upload_album );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  wppa_set_last_album( $upload_album );
382
  }
383
  }
384
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
wppa-utils.php CHANGED
@@ -2238,19 +2238,6 @@ global $wpdb;
2238
  }
2239
  }
2240
 
2241
- // To check on possible duplicate
2242
- function wppa_file_is_in_album( $filename, $alb ) {
2243
- global $wpdb;
2244
-
2245
- if ( ! $filename ) return false; // Copy/move very old photo, before filnametracking
2246
- $photo_id = $wpdb->get_var ( $wpdb->prepare ( "SELECT id FROM $wpdb->wppa_photos " .
2247
- "WHERE ( filename = %s OR filename = %s ) AND album = %s LIMIT 1",
2248
- wppa_sanitize_file_name( $filename ), $filename, $alb
2249
- )
2250
- );
2251
- return $photo_id;
2252
- }
2253
-
2254
  // Retrieve the number of child albums ( if any )
2255
  function wppa_has_children( $alb ) {
2256
  global $wpdb;
2238
  }
2239
  }
2240
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2241
  // Retrieve the number of child albums ( if any )
2242
  function wppa_has_children( $alb ) {
2243
  global $wpdb;
wppa-wpdb-update.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
- * Version 7.0.10
7
  *
8
  */
9
 
@@ -130,7 +130,7 @@ global $wpdb;
130
  return false;
131
  }
132
  }
133
- if ( ! $args['id'] ) return false;
134
  $thumb = wppa_cache_thumb( $args['id'] );
135
  if ( ! $thumb ) return false;
136
  $id = $args['id'];
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
+ * Version 7.1.00
7
  *
8
  */
9
 
130
  return false;
131
  }
132
  }
133
+ if ( ! isset( $args['id'] ) ) return false;
134
  $thumb = wppa_cache_thumb( $args['id'] );
135
  if ( ! $thumb ) return false;
136
  $id = $args['id'];
wppa-wrappers.php CHANGED
@@ -5,7 +5,7 @@
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
- * Version 7.0.09
9
  *
10
  */
11
 
@@ -249,7 +249,7 @@ function wppa_is_file( $path ) {
249
  global $wp_filesystem;
250
 
251
  if ( ! wppa_is_path_safe( $path ) ) {
252
- wppa_log( 'War', 'Unsafe path detected in wppa_is_path(): ' . sanitize_text_field( $path ), true );
253
  return false;
254
  }
255
 
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
+ * Version 7.1.00
9
  *
10
  */
11
 
249
  global $wp_filesystem;
250
 
251
  if ( ! wppa_is_path_safe( $path ) ) {
252
+ wppa_log( 'War', 'Unsafe path detected in wppa_is_file(): ' . sanitize_text_field( $path ), true );
253
  return false;
254
  }
255
 
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: 7.1.00.002
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/
@@ -23,7 +23,7 @@ global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7100'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.1.00.002'; // WPPA software version
27
 
28
  /* start timers */
29
  add_action( 'plugins_loaded', 'wppa_init_timer' );
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: 7.1.00.004
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
23
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7100'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.1.00.004'; // WPPA software version
27
 
28
  /* start timers */
29
  add_action( 'plugins_loaded', 'wppa_init_timer' );