WP Photo Album Plus - Version 7.1.00.002

Version Description

= 7.1.00 =

  • The audiostub image file was overwritten by the last audio posterfile. Fixed.
  • There is now only one upload box on the Photo Albums -> Upload admin page. You can upload all enabled implemented fietypes including zipfiles at once, The order of uploading audio/video files and matching poster images is no longer important.

= 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.002
Comparing to
See all releases

Code changes from version 7.0.12.003 to 7.1.00.002

changelog.txt CHANGED
@@ -1,5 +1,17 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  = 7.0.12 =
4
 
5
  * Update addressline with pretty urls issued a problem on the homepage. Fixed.
1
  WP Photo Album Plus Changelog
2
 
3
+ = 7.1.00 =
4
+
5
+ * The Photo Albums -> Upload Photos admin page now has only one box to upload all configured filetypes.
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
 
17
  * Update addressline with pretty urls issued a problem on the homepage. Fixed.
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
- Version: 7.0.12
6
- Stable tag: 7.0.10.008
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
@@ -137,6 +137,13 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
137
 
138
  == Upgrade Notice ==
139
 
 
 
 
 
 
 
 
140
  = 7.0.11 =
141
 
142
  * This version addresses various bug fixes and feature requests.
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 7.1.00
6
+ Stable tag: 7.0.12.003
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
137
 
138
  == Upgrade Notice ==
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
 
149
  * This version addresses various bug fixes and feature requests.
wppa-links.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
- * Version 7.0.12
7
  *
8
  */
9
 
@@ -764,6 +764,11 @@ function wppa_decompress_pretty( $uri ) {
764
  // Post process pretty url to compressed pretty uri
765
  function wppa_compress_pretty( $uri ) {
766
 
 
 
 
 
 
767
  // Split uri in: before - body - after
768
  $temp = explode( '/wppaspec/', $uri );
769
  $before = $temp[0];
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
+ * Version 7.1.00
7
  *
8
  */
9
 
764
  // Post process pretty url to compressed pretty uri
765
  function wppa_compress_pretty( $uri ) {
766
 
767
+ // Anything to compress?
768
+ if ( strpos( $uri, '/wppaspec/' ) === false ) {
769
+ return $uri;
770
+ }
771
+
772
  // Split uri in: before - body - after
773
  $temp = explode( '/wppaspec/', $uri );
774
  $before = $temp[0];
wppa-non-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
- * Version 7.0.12
7
  *
8
  */
9
 
@@ -430,8 +430,8 @@ global $wppa_opt;
430
  // Panorama
431
  if ( wppa_switch( 'enable_panorama' ) ) {
432
 
433
- // Only if either in header or in footer and panorama's on the page found
434
- if ( ! wppa_switch( 'defer_javascript' ) || ( wppa_switch( 'defer_javascript' ) && wppa( 'has_panorama' ) ) ) {
435
 
436
  if ( is_file ( WPPA_PATH . '/js/wppa-panorama.min.js' ) ) {
437
  $three_url = WPPA_URL . '/js/wppa-panorama.min.js';
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
+ * Version 7.1.00
7
  *
8
  */
9
 
430
  // Panorama
431
  if ( wppa_switch( 'enable_panorama' ) ) {
432
 
433
+ // Only if either in header or in footer and panorama's on the page found or ajax enabled
434
+ if ( ! wppa_switch( 'defer_javascript' ) || ( wppa( 'has_panorama' ) || wppa_switch( 'allow_ajax' ) ) ) {
435
 
436
  if ( is_file ( WPPA_PATH . '/js/wppa-panorama.min.js' ) ) {
437
  $three_url = WPPA_URL . '/js/wppa-panorama.min.js';
wppa-photo-files.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
- * Version 7.0.11
6
  *
7
  */
8
 
@@ -179,7 +179,7 @@ wppa_log('dbg', 'make called with'.$file.' '.$id.' '.$ext.' '.$do_thumb. ' exist
179
  }
180
 
181
  // Find output path photo file
182
- $newimage = wppa_get_photo_path( $id );
183
  if ( $ext ) {
184
  $newimage = wppa_strip_ext( $newimage ) . '.' . strtolower( $ext );
185
  }
@@ -428,13 +428,13 @@ function wppa_create_thumbnail( $id, $use_source = true ) {
428
 
429
  // Use photo path
430
  if ( ! wppa_is_file( $file ) ) {
431
- $file = wppa_get_photo_path( $id );
432
  }
433
  }
434
 
435
  // Not source requested
436
  else {
437
- $file = wppa_get_photo_path( $id );
438
  }
439
 
440
  // If pdf, find image file
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
+ * Version 7.1.00
6
  *
7
  */
8
 
179
  }
180
 
181
  // Find output path photo file
182
+ $newimage = wppa_get_photo_path( $id, false );
183
  if ( $ext ) {
184
  $newimage = wppa_strip_ext( $newimage ) . '.' . strtolower( $ext );
185
  }
428
 
429
  // Use photo path
430
  if ( ! wppa_is_file( $file ) ) {
431
+ $file = wppa_get_photo_path( $id, false );
432
  }
433
  }
434
 
435
  // Not source requested
436
  else {
437
+ $file = wppa_get_photo_path( $id, false );
438
  }
439
 
440
  // If pdf, find image file
wppa-upload-common.php CHANGED
@@ -3,21 +3,32 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
- * Version 7.0.12
7
  *
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
- // @2: Text: 'boxA', 'boxB', 'front', 'import'
 
14
  function wppa_upload_one_item( $file, $album, $from = '' ) {
15
  global $wpdb;
 
 
 
 
16
 
17
  // Check arg
18
  if ( ! is_array( $file ) ) {
19
- wppa_error_message( __( 'Unexpected internal error in wppa_upload_one_item()', 'wp-photo-album-plus' ) . ' ' . $from );
20
- return;
 
 
 
 
 
 
21
  }
22
 
23
  // Save some data and sanitize som data
@@ -25,24 +36,115 @@ global $wpdb;
25
  $file['name'] = wppa_down_ext( $file['name'] );
26
  $file['name'] = wppa_sanitize_album_photo_name( $file['name'] );
27
 
 
 
 
28
  $the_type = wppa_get_ext( $file['name'] );
29
- $existing = $wpdb->get_var( $wpdb->prepare( "SELECT id
30
- FROM $wpdb->wppa_photos
31
- WHERE filename LIKE %s
32
- AND album = %d",
33
- $wpdb->esc_like( wppa_strip_ext( $file['name'] ) ) . '.%',
34
- $album
35
- ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
  // Dispatch on filetype
38
  switch ( $the_type ) {
39
 
40
  case 'pdf':
41
 
 
 
 
 
 
 
 
 
 
 
42
  // Move .pdf to source dir and try to make a poster image .jpg file
43
  wppa_pdf_preprocess( $file, $album );
44
 
45
- // See if poster image is creted by imagick, i.e. $file['tmp_name'] has been replaced by a .jpg
46
  if ( file_exists( $file['tmp_name'] ) ) {
47
  $id = wppa_create_photo_entry( array( 'album' => $album,
48
  'ext' => 'jpg',
@@ -51,7 +153,6 @@ global $wpdb;
51
  'sname' => $file['name'],
52
  ) );
53
  wppa_copy( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
54
- wppa_cache_photo( 'invalidate', $id );
55
  wppa_make_the_photo_files( wppa_get_source_album_dir( $album ) . '/' . $file['name'], $id, 'jpg' );
56
  }
57
 
@@ -64,12 +165,9 @@ global $wpdb;
64
  'sname' => $file['name'],
65
  ) );
66
  }
67
- wppa( 'is_pdf', false );
68
 
69
- // Update treecounts
70
- wppa_invalidate_treecounts( $album );
71
-
72
- return true; // Yes we uploaded a file
73
  break;
74
 
75
  case 'jpg':
@@ -77,40 +175,220 @@ global $wpdb;
77
  case 'png':
78
  case 'gif':
79
 
80
- // Poster file?
81
- if ( $existing ) {
82
- $pdf_poster = wppa_is_pdf( $existing );
83
- $multi_poster = wppa_is_multi( $existing );
84
- }
85
- else {
86
- $pdf_poster = false;
87
- $multi_poster = false;
88
- }
89
-
90
- // Process posterfile
91
- if ( $pdf_poster || $multi_poster ) {
92
  wppa_move_uploaded_file( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
93
- if ( $pdf_poster ) {
94
- echo 'Updating '.$existing.', '.$file['name'].' '.$the_type;
95
- wppa_update_photo( array( 'id' => $existing, 'ext' => $the_type ) );
96
  }
97
- wppa_cache_photo( 'invalidate', $existing );
98
- wppa_make_the_photo_files( wppa_get_source_album_dir( $album ) . '/' . $file['name'], $existing, wppa_get_ext( $file['name'] ) );
99
- return true;
 
100
  }
101
 
102
  // Just a photo
103
  $id = wppa_insert_photo( $file['tmp_name'], $album, $file['name'] );
104
  if ( $id ) {
105
- return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
  }
 
 
107
  else {
108
- wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'] ) ) . '.' );
109
- return false;
 
110
  }
111
  break;
112
 
113
  default:
114
- wppa_error_message( __( 'Unsupported filetype encountered', 'wp-photo-album-plus' ) . ': ' . $the_type );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
+ * Version 7.1.00
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'
15
  function wppa_upload_one_item( $file, $album, $from = '' ) {
16
  global $wpdb;
17
+ global $wppa_supported_photo_extensions;
18
+ global $wppa_supported_video_extensions;
19
+ global $wppa_supported_audio_extensions;
20
+ global $wppa_supported_document_extensions;
21
 
22
  // Check arg
23
  if ( ! is_array( $file ) ) {
24
+ wppa_upload_common_error( __( 'Unexpected internal error in wppa_upload_one_item()', 'wp-photo-album-plus' ), $from );
25
+ return false;
26
+ }
27
+
28
+ // Check on upload error
29
+ if ( $file['error'] ) {
30
+ wppa_upload_common_error( __( 'Upload error', 'wp-photo-album-plus' ) . ': ' . $file['error'] );
31
+ return false;
32
  }
33
 
34
  // Save some data and sanitize som data
36
  $file['name'] = wppa_down_ext( $file['name'] );
37
  $file['name'] = wppa_sanitize_album_photo_name( $file['name'] );
38
 
39
+ // Test if we try to upload a supported filetype
40
+ $supp = wppa_get_supported_extensions();
41
+
42
  $the_type = wppa_get_ext( $file['name'] );
43
+ if ( ! in_array( $the_type, $supp ) ) {
44
+ wppa_upload_common_error( __( 'Invalid file-extension found during upload. Supported filetypes are', 'wp-photo-album-plus' ) . ': ' . implode( ', ', $supp ), $from );
45
+ return false;;
46
+ }
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
53
+ AND album = %d",
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 ) ) {
60
+ $ext_type = 'video';
61
+ }
62
+ elseif ( wppa_has_audio( $ext_id ) ) {
63
+ $ext_type = 'audio';
64
+ }
65
+ elseif ( wppa_is_pdf( $ext_id ) ) {
66
+ $ext_type = 'document';
67
+ }
68
+ elseif ( in_array( $ext_ext, array( 'jpg', 'jpeg', 'png', 'gif' ) ) ) {
69
+ $ext_type = 'image';
70
+ }
71
+ else {
72
+ $ex_type = 'unknown';
73
+ }
74
+ }
75
+
76
+ if ( in_array( $the_type, $wppa_supported_video_extensions ) ) {
77
+ $new_type = 'video';
78
+ }
79
+ elseif ( in_array( $the_type, $wppa_supported_audio_extensions ) ) {
80
+ $new_type = 'audio';
81
+ }
82
+ elseif ( in_array( $the_type, $wppa_supported_document_extensions ) ) {
83
+ $new_type = 'document';
84
+ }
85
+ elseif ( in_array( $the_type, array( 'jpg', 'jpeg', 'png', 'gif' ) ) ) {
86
+ $new_type = 'image';
87
+ }
88
+ else {
89
+ $new_type = 'unknown';
90
+ }
91
+
92
+ // Cheack against incompatible combinations
93
+ $cerr = false;
94
+ if ( $ext_type == 'video' && $new_type == 'audio' || $ext_type == 'audio' && $new_type == 'video' ) {
95
+ $cerr = true;
96
+ }
97
+ elseif ( $ext_type == 'video' && $new_type == 'document' || $ext_type == 'document' && $new_type == 'video' ) {
98
+ $cerr = true;
99
+ }
100
+ elseif ( $ext_type == 'audio' && $new_type == 'document' || $ext_type == 'document' && $new_type == 'audio' ) {
101
+ $cerr = true;
102
+ }
103
+ elseif ( $ext_type == 'audio' && $new_type == 'document' || $ext_type == 'document' && $new_type == 'audio' ) {
104
+ $cerr = true;
105
+ }
106
+ elseif ( $ext_type == 'video' && $new_type == 'document' || $ext_type == 'document' && $new_type == 'video' ) {
107
+ $cerr = true;
108
+ }
109
+ if ( $cerr ) {
110
+ wppa_upload_common_error( sprintf( __( 'You can not combine %s with %s files', 'wp-photo-album-plus' ), $ext_type, $new_type ), $from );
111
+ return false;;
112
+ }
113
+
114
+ // Check against duplicate files
115
+ if ( $new_type == 'image' || $new_type == 'document' ) {
116
+ if ( $ext_type == $new_type ) {
117
+ if ( wppa_switch( 'void_dups' ) ) {
118
+ wppa_upload_common_ok( sprintf( __( 'Item %s already exists in this album and will be overwritten', 'wp-photo-album-plus' ), $file['name'] ), $from );
119
+ }
120
+ else {
121
+
122
+ // Forget its a dup
123
+ $ext_type = '';
124
+ $ext_id = false;
125
+ }
126
+ }
127
+ }
128
 
129
  // Dispatch on filetype
130
  switch ( $the_type ) {
131
 
132
  case 'pdf':
133
 
134
+ // If image already exists, just add the pdf and set the file extension right
135
+ if ( $ext_id ) {
136
+ wppa_copy( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
137
+ wppa_update_photo( array( 'id' => $ext_id,
138
+ 'filename' => wppa_strip_ext( $file['name'] ) . '.pdf',
139
+ ) );
140
+ wppa_upload_post_process( $the_type, $album, $ext_id, $from );
141
+ return true;;
142
+ }
143
+
144
  // Move .pdf to source dir and try to make a poster image .jpg file
145
  wppa_pdf_preprocess( $file, $album );
146
 
147
+ // If poster image is creted by imagick, i.e. $file['tmp_name'] has been replaced by a .jpg
148
  if ( file_exists( $file['tmp_name'] ) ) {
149
  $id = wppa_create_photo_entry( array( 'album' => $album,
150
  'ext' => 'jpg',
153
  'sname' => $file['name'],
154
  ) );
155
  wppa_copy( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
 
156
  wppa_make_the_photo_files( wppa_get_source_album_dir( $album ) . '/' . $file['name'], $id, 'jpg' );
157
  }
158
 
165
  'sname' => $file['name'],
166
  ) );
167
  }
 
168
 
169
+ wppa_upload_post_process( $the_type, $album, $id, $from );
170
+ return true;; // Yes we uploaded a file
 
 
171
  break;
172
 
173
  case 'jpg':
175
  case 'png':
176
  case 'gif':
177
 
178
+ // Process posterfile or update existing image file (dups not allowed)
179
+ if ( $ext_type == 'video' || $ext_type == 'audio' || $ext_type == 'document' || $ext_type == $new_type ) {
180
+ wppa_log( 'dbg', 'Updating ' . $ext_id . ', ' . $file['name'] . ' ' . $ext_type . ' width ' . $the_type );
 
 
 
 
 
 
 
 
 
181
  wppa_move_uploaded_file( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
182
+ if ( $ext_type == 'document' ) {
183
+ wppa_update_photo( array( 'id' => $ext_id, 'ext' => $the_type ) );
 
184
  }
185
+ wppa_cache_photo( 'invalidate', $ext_id );
186
+ wppa_make_the_photo_files( wppa_get_source_album_dir( $album ) . '/' . $file['name'], $ext_id, wppa_get_ext( $file['name'] ) );
187
+ wppa_upload_post_process( $the_type, $album, $ext_id, $from );
188
+ return true;; // Yes we uploaded a file
189
  }
190
 
191
  // Just a photo
192
  $id = wppa_insert_photo( $file['tmp_name'], $album, $file['name'] );
193
  if ( $id ) {
194
+ wppa_upload_post_process( $the_type, $album, $id, $from );
195
+ return true;; // Yes we uploaded a file
196
+ }
197
+ else {
198
+ wppa_upload_common_error( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'] ) ) . '.', $from );
199
+ return false;; // No we did not uploaded a file
200
+ }
201
+ break;
202
+
203
+ case 'mp4':
204
+ case 'ogv':
205
+ case 'webm':
206
+ case 'mp3':
207
+ case 'wav':
208
+ case 'ogg':
209
+
210
+ // Add new entry
211
+ if ( ! $ext_id ) {
212
+ $id = wppa_create_photo_entry( array( 'album' => $album, 'filename' => $file['name'], 'ext' => 'xxx', 'name' => wppa_strip_ext( $file['name'] ) ) );
213
+ }
214
+ else {
215
+ $id = $ext_id;
216
+ }
217
+
218
+ // Add file
219
+ $newpath = wppa_strip_ext( wppa_get_photo_path( $id, false ) ) . '.' . $the_type;
220
+ $fs = filesize( $file['tmp_name'] );
221
+ if ( $fs > 1024*1024*64 ) { // copy fails for files > 64 Mb
222
+
223
+ // Remove old version if already exists
224
+ if ( wppa_is_file( $newpath ) ) {
225
+ wppa_unlink( $newpath );
226
+ }
227
+ wppa_rename( $file['tmp_name'], $newpath );
228
+ }
229
+ else {
230
+ wppa_copy( $file['tmp_name'], $newpath );
231
+ }
232
+
233
+ // Make sure ext is set to xxx after adding audio or video
234
+ wppa_update_photo( array( 'id' => $id,
235
+ 'filename' => wppa_strip_ext( $file['name'] ) . '.xxx',
236
+ 'ext' => 'xxx',
237
+ ) );
238
+ wppa_upload_post_process( $the_type, $album, $id, $from );
239
+ return true;; // Yes we uploaded a file
240
+ break;
241
+
242
+ case 'zip':
243
+
244
+ $zipfile = WPPA_DEPOT_PATH . '/' . wppa_sanitize_file_name( $file['name'] );
245
+ wppa_copy( $file['tmp_name'], $zipfile );
246
+
247
+ $zip = new ZipArchive;
248
+
249
+ if ( $zip->open( $zipfile ) === true ) {
250
+
251
+ $done = '0';
252
+ $skip = '0';
253
+ for ( $i = 0; $i < $zip->numFiles; $i++ ) {
254
+
255
+ $stat = $zip->statIndex( $i );
256
+ /* statIndex returns:
257
+ Array
258
+ (
259
+ [name] => foobar/baz
260
+ [index] => 3
261
+ [crc] => 499465816
262
+ [size] => 27
263
+ [mtime] => 1123164748
264
+ [comp_size] => 24
265
+ [comp_method] => 8
266
+ )
267
+ */
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;
275
+ if ( strpos( $stat['name'], '/' ) !== false ) {
276
+ $fullname = $stat['name'];
277
+ $names = explode( '/', $fullname );
278
+ $i = 0;
279
+
280
+ while ( $i < count( $names ) -1 ) {
281
+
282
+ // Find album with parent is current and name is subalbum name
283
+ $a = $wpdb->get_var( $wpdb->prepare( "SELECT `id`
284
+ FROM $wpdb->wppa_albums
285
+ WHERE `name` = %s
286
+ AND `a_parent` = %d
287
+ LIMIT 1", $names[$i], $p ) );
288
+
289
+ // If not found, create it
290
+ if ( ! $a ) {
291
+ $a = wppa_create_album_entry( array( 'name' => $names[$i],
292
+ 'a_parent' => $p,
293
+ ) );
294
+ }
295
+
296
+ $p = $a;
297
+ $i++;
298
+ }
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
+ );
306
+ $iret = wppa_upload_one_item( $zfile, $p, $from );
307
+ if ( $iret ) {
308
+ $done++;
309
+ }
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.
317
+ elseif ( strpos( $stat['name'], '.' ) !== false && strlen( $file_ext ) < 5 ) {
318
+ wppa_upload_common_error( sprintf( __( 'File %s is of an unsupported filetype and has been ignored during extraction.', 'wp-photo-album-plus'), wppa_sanitize_file_name( $stat['name'] ) ), $from );
319
+ $skip++;
320
+ }
321
+ }
322
+
323
+ $zip->close();
324
+ wppa_upload_common_ok( sprintf( __( 'Zipfile %s processed. %s files extracted, %s files skipped.', 'wp-photo-album-plus'), basename( $zipfile ), $done, $skip ), $from );
325
+
326
+ wppa_unlink( $zipfile );
327
+ return true;; // Yes we uploaded a file
328
  }
329
+
330
+ // Zipfile can not be opened
331
  else {
332
+ wppa_upload_common_error( __( 'Failed to extract', 'wp-photo-album-plus').' '.$zipfile, $from );
333
+ wppa_unlink( $zipfile );
334
+ return false;;
335
  }
336
  break;
337
 
338
  default:
339
+ wppa_upload_common_error( __( 'Unsupported filetype encountered', 'wp-photo-album-plus' ) . ': ' . $the_type, $from );
340
+ return false;; // No we did not uploaded a file
341
+ }
342
+ }
343
+
344
+ function wppa_upload_common_error( $error, $from ) {
345
+
346
+ switch( $from ) {
347
+ case 'upload':
348
+ wppa_error_message( $error );
349
+ break;
350
+ }
351
+ }
352
+
353
+ function wppa_upload_common_ok( $error, $from ) {
354
+
355
+ switch( $from ) {
356
+ case 'upload':
357
+ wppa_ok_message( $error );
358
+ break;
359
  }
360
  }
361
+
362
+ function wppa_get_supported_extensions() {
363
+ global $wppa_supported_photo_extensions;
364
+ global $wppa_supported_video_extensions;
365
+ global $wppa_supported_audio_extensions;
366
+ global $wppa_supported_document_extensions;
367
+
368
+ $supp = $wppa_supported_photo_extensions;
369
+ if ( wppa_switch( 'enable_video' ) ) {
370
+ $supp = array_merge( $supp, $wppa_supported_video_extensions );
371
+ }
372
+ if ( wppa_switch( 'enable_audio' ) ) {
373
+ $supp = array_merge( $supp, $wppa_supported_audio_extensions );
374
+ }
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;
382
+ }
383
+
384
+ function wppa_upload_post_process( $the_type, $album, $id, $from ) {
385
+
386
+ wppa_set_default_name( $id, wppa( 'unsanitized_filename' ) );
387
+ wppa_invalidate_treecounts( $album );
388
+ wppa_cache_photo( 'invalidate', $id );
389
+ wppa_update_photo( array( 'id' => $id,
390
+ 'sname' => wppa_sanitize_album_photo_name( wppa_get_photo_item( $id, 'name' ) ),
391
+ ) );
392
+ wppa( 'is_pdf', false );
393
+
394
+ }
wppa-upload.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
- * Version 7.0.12
7
  *
8
  */
9
 
@@ -91,6 +91,8 @@ global $upload_album;
91
  <?php }
92
  }
93
  }
 
 
94
  // From BOX B
95
  if ( isset( $_POST['wppa-upload'] ) ) {
96
  check_admin_referer( '$wppa_nonce', WPPA_NONCE );
@@ -118,7 +120,7 @@ global $upload_album;
118
  <script type="text/javascript" >document.location = '<?php echo( wppa_dbg_url( get_admin_url().'admin.php?page=wppa_import_photos&zip='.$target, 'js' ) ) ?>';</script>
119
  <?php }
120
  }
121
-
122
  // sanitize system again
123
  wppa_sanitize_files();
124
 
@@ -257,40 +259,43 @@ global $upload_album;
257
 
258
  // Box A: Upload Multple photos
259
  echo
260
- '<div' .
261
- ' style="' .
262
- 'border:1px solid #ccc;' .
263
- 'padding:10px;' .
264
- 'margin-bottom:10px;' .
265
- 'width: 600px;' .
266
- '"' .
267
- ' >' .
268
- '<h3 style="margin-top:0px;">' .
269
- __( 'Box A:' , 'wp-photo-album-plus' ) . ' ' . __( 'Multiple Photos in one selection' , 'wp-photo-album-plus' ) .
270
- '</h3>' .
271
- sprintf( __( 'You can select up to %s photos in one selection and upload them.' , 'wp-photo-album-plus' ), $max_files_txt ) .
272
- '<br />' .
273
- '<small style="color:blue" >' .
274
- __( 'You need a modern browser that supports HTML-5 to select multiple files' , 'wp-photo-album-plus') .
275
- '</small>' .
276
- '<form' .
277
- ' enctype="multipart/form-data"' .
278
- ' action="' . wppa_dbg_url( get_admin_url() . 'admin.php?page=wppa_upload_photos' ) . '"' .
279
- ' method="post" >' .
280
- wp_nonce_field( '$wppa_nonce', WPPA_NONCE, true, false ) .
281
- '<input' .
282
- ' id="my_files"' .
283
- ' type="file"' .
284
- ' multiple="multiple"' .
285
- ' name="my_files[]"' .
286
- ' onchange="showit()"' .
287
- ' />' .
288
- '<div id="files_list2" >' .
289
- '<h3>' .
290
- __( 'Selected Files:' , 'wp-photo-album-plus' ) .
291
- '</h3>' .
292
- '</div>' .
293
- '<script type="text/javascript" >' .
 
 
 
294
  'function showit() {' .
295
  'var maxsize = parseInt( \'' . $max_tot_size_mbytes . '\' ) * 1024 * 1024;' .
296
  'var maxcount = parseInt( \'' . $max_files_txt . '\' );' .
@@ -399,7 +404,7 @@ global $upload_album;
399
  '</form>' .
400
  '</div>';
401
  // End BOX A
402
-
403
  // Box B: Single photos
404
  echo
405
  '<div style="border:1px solid #ccc; padding:10px; margin-bottom:10px; width: 600px;" >' .
@@ -539,6 +544,7 @@ global $upload_album;
539
  '</div>';
540
  }
541
  }
 
542
  }
543
 
544
  echo
@@ -564,12 +570,12 @@ global $upload_album;
564
  'size' => $the_file['size'][$i],
565
  );
566
 
567
- if ( wppa_upload_one_item( $file, $upload_album, 'boxA' ) ) {
568
  $count++;
569
  }
570
 
571
  if ( wppa_is_time_up() ) {
572
- wppa_warning_message( sprintf( __( 'Time out. %s photos uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
573
  wppa_set_last_album( $upload_album );
574
  return;
575
  }
@@ -577,7 +583,7 @@ global $upload_album;
577
  }
578
 
579
  if ( $count ) {
580
- wppa_update_message( $count.' '.__( 'Photos Uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
581
  wppa_set_last_album( $upload_album );
582
  }
583
  }
@@ -593,20 +599,20 @@ global $upload_album;
593
  foreach ( $_FILES as $file ) {
594
 
595
  if ( $file['name'] ) {
596
- if ( wppa_upload_one_item( $file, $upload_album, 'boxB' ) ) {
597
  $count++;
598
  }
599
  }
600
 
601
  if ( wppa_is_time_up() ) {
602
- wppa_warning_message( sprintf( __( 'Time out. %s photos uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
603
  wppa_set_last_album( $upload_album );
604
  return;
605
  }
606
  }
607
 
608
  if ( $count ) {
609
- wppa_update_message( $count.' '.__( 'Photos Uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
610
  wppa_set_last_album( $upload_album );
611
  }
612
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
+ * Version 7.1.00
7
  *
8
  */
9
 
91
  <?php }
92
  }
93
  }
94
+
95
+ /*
96
  // From BOX B
97
  if ( isset( $_POST['wppa-upload'] ) ) {
98
  check_admin_referer( '$wppa_nonce', WPPA_NONCE );
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
 
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 . '\' );' .
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;" >' .
544
  '</div>';
545
  }
546
  }
547
+ */
548
  }
549
 
550
  echo
570
  'size' => $the_file['size'][$i],
571
  );
572
 
573
+ if ( wppa_upload_one_item( $file, $upload_album, 'upload' ) ) {
574
  $count++;
575
  }
576
 
577
  if ( wppa_is_time_up() ) {
578
+ wppa_warning_message( sprintf( __( 'Time out. %s files uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
579
  wppa_set_last_album( $upload_album );
580
  return;
581
  }
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
  }
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
  }
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.0.12
7
  *
8
  */
9
 
@@ -12,6 +12,9 @@ if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
12
  global $wppa_supported_photo_extensions;
13
  $wppa_supported_photo_extensions = array( 'jpg', 'jpeg', 'png', 'gif' );
14
 
 
 
 
15
  // Get url in wppa dir
16
  function wppa_url( $arg ) {
17
  return WPPA_URL . '/' . $arg;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.1.00
7
  *
8
  */
9
 
12
  global $wppa_supported_photo_extensions;
13
  $wppa_supported_photo_extensions = array( 'jpg', 'jpeg', 'png', 'gif' );
14
 
15
+ global $wppa_supported_document_extensions;
16
+ $wppa_supported_document_extensions = array( 'pdf' );
17
+
18
  // Get url in wppa dir
19
  function wppa_url( $arg ) {
20
  return WPPA_URL . '/' . $arg;
wppa-wpdb-insert.php CHANGED
@@ -280,7 +280,7 @@ global $wpdb;
280
  'magickstack' => '',
281
  'indexdtm' => '',
282
  'panorama' => '0',
283
- 'sname' => '',
284
  ) );
285
 
286
  if ( $args['scheduledtm'] ) $args['status'] = 'scheduled';
@@ -396,7 +396,7 @@ global $wpdb;
396
  'crypt' => wppa_get_unique_album_crypt(),
397
  'treecounts' => serialize( array( 1,0,0,0,0,0,0,0,0,0,0 ) ),
398
  'indexdtm' => '',
399
- 'sname' => wppa_sanitize_album_photo_name( __( 'New Album', 'wp-photo-album-plus' ) ),
400
  ) );
401
 
402
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
280
  'magickstack' => '',
281
  'indexdtm' => '',
282
  'panorama' => '0',
283
+ 'sname' => wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : '' ),
284
  ) );
285
 
286
  if ( $args['scheduledtm'] ) $args['status'] = 'scheduled';
396
  'crypt' => wppa_get_unique_album_crypt(),
397
  'treecounts' => serialize( array( 1,0,0,0,0,0,0,0,0,0,0 ) ),
398
  'indexdtm' => '',
399
+ 'sname' => wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : __( 'New Album', 'wp-photo-album-plus' ) ),
400
  ) );
401
 
402
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
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.0.12.003
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -22,8 +22,8 @@ global $wpdb;
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
- global $wppa_revno; $wppa_revno = '7012'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.0.12.003'; // 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.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/
22
  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' );