WP Photo Album Plus - Version 8.2.05.008

Version Description

= 8.1.08 =

  • This version addresses various bug fixes, feature requests and security fixes.
Download this release

Release Info

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

Code changes from version 8.2.05.007 to 8.2.05.008

changelog.txt CHANGED
@@ -10,6 +10,8 @@ WP Photo Album Plus Changelog
10
  * Added Timstamp descending to the sub-album sequence methods.
11
  * Added import from realmedialibrary plugin categorized wp media.
12
  * Fixed a slideshow pagination issue that resulted in serious performance degradations on large slideshows.
 
 
13
 
14
  = 8.2.04 =
15
 
10
  * Added Timstamp descending to the sub-album sequence methods.
11
  * Added import from realmedialibrary plugin categorized wp media.
12
  * Fixed a slideshow pagination issue that resulted in serious performance degradations on large slideshows.
13
+ * Multiline settings lost their linebreaks. Fixed.
14
+ * You can now directly download exported albums on the export page. Also timeouts are now detected.
15
 
16
  = 8.2.04 =
17
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, f
5
  Requires at least: 3.9
6
  Tested up to: 6.0
7
  Requires PHP: 5.5
8
- Stable tag: 8.2.04.009
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
5
  Requires at least: 3.9
6
  Tested up to: 6.0
7
  Requires PHP: 5.5
8
+ Stable tag: 8.2.05.008
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 8.2.05.005
6
  *
7
  */
8
 
@@ -2995,6 +2995,20 @@ global $wppa;
2995
  if ( in_array( $option, ['wppa_newphoto_description', 'wppa_bc_txt', 'wppa_custom_content', 'wppa_copyright_notice'] ) ) {
2996
  $filter = 'html';
2997
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2998
  $value = wppa_decode( wppa_get( 'value', '', $filter ) ); // The new value, may also contain & # and +
2999
  $value = stripslashes( $value );
3000
  $value = trim( $value ); // Remaove surrounding spaces
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 8.2.05.008
6
  *
7
  */
8
 
2995
  if ( in_array( $option, ['wppa_newphoto_description', 'wppa_bc_txt', 'wppa_custom_content', 'wppa_copyright_notice'] ) ) {
2996
  $filter = 'html';
2997
  }
2998
+ if ( in_array( $option, ['wppa_custom_content',
2999
+ 'wppa_search_toptext',
3000
+ 'wppa_search_selbox_0',
3001
+ 'wppa_search_selbox_1',
3002
+ 'wppa_search_selbox_2',
3003
+ 'wppa_copyright_notice',
3004
+ 'wppa_nicescroll_opts',
3005
+ 'wppa_newphoto_description',
3006
+ 'wppa_admin_inline_css',
3007
+ 'wppa_custom_album_proc',
3008
+ 'wppa_custom_photo_proc',
3009
+ 'wppa_textual_watermark_text'] ) ) {
3010
+ $filter = 'textarea';
3011
+ }
3012
  $value = wppa_decode( wppa_get( 'value', '', $filter ) ); // The new value, may also contain & # and +
3013
  $value = stripslashes( $value );
3014
  $value = trim( $value ); // Remaove surrounding spaces
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 8.2.05.001
7
  *
8
  */
9
 
@@ -529,7 +529,7 @@ global $wppa_session;
529
  for ( $sb = 0; $sb < $selboxes; $sb++ ) {
530
  $opts[$sb] = array_merge( array( '' ), explode( "\n", wppa_opt( 'search_selbox_' . $sb ) ) );
531
  $vals[$sb] = $opts[$sb];
532
- $current = wppa_get( 'searchselbox-' . $sb );
533
 
534
  // Item wrapper
535
  $result .= '
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 8.2.05.008
7
  *
8
  */
9
 
529
  for ( $sb = 0; $sb < $selboxes; $sb++ ) {
530
  $opts[$sb] = array_merge( array( '' ), explode( "\n", wppa_opt( 'search_selbox_' . $sb ) ) );
531
  $vals[$sb] = $opts[$sb];
532
+ $current = wppa_get( 'searchselbox-' . $sb, '', 'text' );
533
 
534
  // Item wrapper
535
  $result .= '
wppa-date-time.php CHANGED
@@ -274,7 +274,7 @@ function wppa_local_strtotime( $str ) {
274
  $tzstring = wppa_get_option( 'timezone_string' );
275
 
276
  // Correct $time according to gmt_offset
277
- $current_offset = wppa_get_option( 'gmt_offset', 0 ) * 3600;
278
  $result -= $current_offset;
279
 
280
  return $result;
274
  $tzstring = wppa_get_option( 'timezone_string' );
275
 
276
  // Correct $time according to gmt_offset
277
+ $current_offset = intval( wppa_get_option( 'gmt_offset', 0 ) ) * 3600;
278
  $result -= $current_offset;
279
 
280
  return $result;
wppa-export.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
- * Version 8.2.05.002
7
  *
8
  */
9
 
@@ -16,58 +16,69 @@ global $wpdb;
16
  if ( wppa_get( 'export-submit' ) ) {
17
  check_admin_referer( '$wppa_nonce', WPPA_NONCE );
18
  wppa_export_photos();
19
- } ?>
 
20
  <div class="wrap">
21
- <?php $iconurl = WPPA_URL.'/img/album32.png'; ?>
22
- <div id="icon-camera" class="icon32" style="background: transparent url(<?php echo($iconurl); ?>) no-repeat">
23
- </div>
24
- <?php $iconurl = WPPA_URL.'/img/arrow32.png'; ?>
25
- <div id="icon-arrow" class="icon32" style="background: transparent url(<?php echo($iconurl); ?>) no-repeat">
26
- </div>
27
- <?php $iconurl = WPPA_URL.'/img/disk32.png'; ?>
28
- <div id="icon-disk" class="icon32" style="background: transparent url(<?php echo($iconurl); ?>) no-repeat">
29
- <br>
30
- </div>
31
-
32
- <h2><?php _e('Export Photos', 'wp-photo-album-plus' ); ?></h2><br>
33
-
34
- <form action="<?php echo(get_admin_url().'admin.php?page=wppa_export_photos') ?>" method="post">
35
- <?php wp_nonce_field('$wppa_nonce', WPPA_NONCE); ?>
36
- <?php echo(sprintf(__('Photos will be exported to: <b>%s</b>.', 'wp-photo-album-plus' ), WPPA_DEPOT)) ?>
37
- <h2><?php _e('Export photos from album <span style="font-size:12px;">(Including Album information)</span>:', 'wp-photo-album-plus' ); ?></h2>
38
- <?php $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums " . wppa_get_album_order(), ARRAY_A);
39
- $high = '0'; ?>
40
 
 
 
 
 
41
  <table class="form-table albumtable">
42
  <thead>
43
  </thead>
44
  <tbody>
45
- <tr>
46
- <?php $ct = 0;
47
- foreach($albums as $album) {
48
- $line = '&nbsp;'.$album['id'].':&nbsp;'.__(stripslashes($album['name']));
49
- if ($album['id'] > $high) $high = $album['id']; ?>
50
- <td>
51
- <input type="checkbox" name="album-<?php echo($album['id']) ?>" />&nbsp;<?php echo($line) ?>
52
- </td>
53
- <?php if ($ct == 4) { // Wrap to newline
54
- echo('</tr><tr>');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  $ct = 0;
56
  }
57
  else {
58
  $ct++;
59
  }
60
- } ?>
 
61
  </tr>
62
  </tbody>
63
  </table>
64
- <input type="hidden" name="high" value="<?php echo($high) ?>" />
65
  <p>
66
- <input type="submit" class="button-primary" name="wppa-export-submit" value="<?php _e('Export', 'wp-photo-album-plus' ); ?>" />
67
  </p>
68
  </form>
69
- </div>
70
- <?php
71
  }
72
 
73
  function wppa_export_photos() {
@@ -78,79 +89,123 @@ global $wppa_temp_idx;
78
 
79
  $wppa_temp_idx = 0;
80
 
81
- _e('Exporting...<br/>', 'wp-photo-album-plus' );
 
82
  if ( PHP_VERSION_ID >= 50207 && class_exists('ZipArchive') ) {
83
- echo('Opening zip output file...');
84
- $wppa_zip = new ZipArchive;
85
- $zipid = wppa_get_option('wppa_last_zip', '0');
86
- $zipid++;
87
- wppa_update_option('wppa_last_zip', $zipid);
88
- $zipfile = WPPA_DEPOT_PATH.'/wppa-'.$zipid.'.zip';
89
- if ($wppa_zip->open($zipfile, 1) === TRUE) {
90
- _e('ok, <br/>Filling', 'wp-photo-album-plus' ); echo(' '.basename($zipfile));
91
- } else {
92
- _e('failed<br/>', 'wp-photo-album-plus' );
93
- $wppa_zip = false;
94
- }
95
  }
96
  else {
97
- $wppa_zip = false;
98
  if ( PHP_VERSION_ID < 50207 ) wppa_warning_message(__('Can export albums and photos, but cannot make a zipfile. Your php version is < 5.2.7.', 'wp-photo-album-plus' ));
99
  if ( ! class_exists('ZipArchive') ) wppa_warning_message(__('Can export albums and photos, but cannot make a zipfile. Your php version does not support ZipArchive.', 'wp-photo-album-plus' ));
100
  }
101
 
102
- $high = wppa_get( 'high', '0' );
103
-
104
- if ( $high ) {
105
- $id = 0;
106
- $cnt = 0;
107
- while ( $id <= $high ) {
108
- if ( wppa_get( 'album-' . $id, '0', 'text' ) ) {
109
- _e('<br/>Processing album', 'wp-photo-album-plus' ); echo(' '.$id.'....');
110
- wppa_write_album_file_by_id($id);
111
- $photos = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
112
- WHERE album = %d", $id ), ARRAY_A );
113
- $cnt = 0;
114
- foreach ( $photos as $photo ) {
115
-
116
- // Copy the photo
117
- $photo_id = strval( intval( $photo['id'] ) );
118
- $from = wppa_get_photo_path( $photo_id );
119
- $to = WPPA_DEPOT_PATH . '/' . $photo_id . '.' . $photo['ext'];
120
-
121
- if ( $wppa_zip ) {
122
- $wppa_zip->addFile ( $from, basename ( $to ) );
123
- }
124
- else wppa_copy ( $from, $to );
125
 
126
- // Create the metadata
127
- if ( ! wppa_write_photo_file ( $photo ) ) {
128
- return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
129
  }
130
- else $cnt++;
131
  }
132
- _e('done.', 'wp-photo-album-plus' ); echo(' '.$cnt.' '); _e('photos processed.', 'wp-photo-album-plus' );
133
  }
134
- $id++;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
135
  }
136
- _e('<br/>Done export albums.', 'wp-photo-album-plus' );
 
 
 
 
137
  }
138
  else {
139
- _e('Nothing to export', 'wp-photo-album-plus' );
140
  }
 
141
 
142
- if ($wppa_zip) {
143
- _e('<br/>Closing zip.', 'wp-photo-album-plus' );
144
- _e('<br/>Deleting temp files.', 'wp-photo-album-plus' );
145
- $wppa_zip->close();
146
- // Now the zip is closed we can destroy all tempfiles we created here
147
- if (is_array($wppa_temp)) {
148
- foreach ($wppa_temp as $file) {
149
- unlink($file);
150
- }
151
- }
152
- }
153
- _e('<br/>Done!', 'wp-photo-album-plus' );
154
  }
155
 
156
  function wppa_write_album_file_by_id($id) {
@@ -292,4 +347,23 @@ global $wppa_temp_idx;
292
  return false;
293
  }
294
  return true;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
+ * Version 8.2.05.008
7
  *
8
  */
9
 
16
  if ( wppa_get( 'export-submit' ) ) {
17
  check_admin_referer( '$wppa_nonce', WPPA_NONCE );
18
  wppa_export_photos();
19
+ }
20
+ wppa_echo( '
21
  <div class="wrap">
22
+ <h2>' .
23
+ __( 'Export Photos', 'wp-photo-album-plus' ) . '
24
+ </h2>
25
+ <br>
26
+
27
+ <form action="' . esc_url( get_admin_url() . 'admin.php?page=wppa_export_photos' ) . '" method="post"> ' .
28
+ wp_nonce_field( '$wppa_nonce', WPPA_NONCE ) .
29
+ sprintf( __( 'Photos will be exported to: <b>%s</b>.', 'wp-photo-album-plus' ), WPPA_DEPOT ) . '
30
+ <h2>' .
31
+ __( 'Export photos from album <span style="font-size:12px;">(Including Album information)</span>:', 'wp-photo-album-plus' ) . '
32
+ </h2>' );
 
 
 
 
 
 
 
 
33
 
34
+ $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums ORDER BY name", ARRAY_A );
35
+ // $high = '0';
36
+
37
+ wppa_echo( '
38
  <table class="form-table albumtable">
39
  <thead>
40
  </thead>
41
  <tbody>
42
+ <tr>' );
43
+ $ct = 0;
44
+ foreach( $albums as $album ) {
45
+ $id = $album['id'];
46
+ $line = '&nbsp;' . $id . ':&nbsp;' . __( stripslashes( $album['name'] ) );
47
+
48
+ if ( is_file( WPPA_DEPOT_PATH . '/album-' . $id . '.zip' ) ) {
49
+ wppa_echo( '
50
+ <td>
51
+ <a
52
+ href="' . esc_attr( WPPA_DEPOT_URL . '/album-' . $id . '.zip' ) . '"
53
+ download="' . esc_attr( wppa_get_album_name( $id ) ) . '">
54
+ <input type="button" class="button-primary" value="' . esc_attr( __( 'Download', 'wp-photo-album-plus' ) . ' ' . $line ) . '">
55
+ </a>
56
+ </td>' );
57
+ }
58
+ else {
59
+ wppa_echo( '
60
+ <td>
61
+ <input type="checkbox" name="album-' . $album['id'] . '">&nbsp;' . $line . '
62
+ </td>' );
63
+ }
64
+ if ( $ct == 4 ) {
65
+ wppa_echo( '</tr><tr>' );
66
  $ct = 0;
67
  }
68
  else {
69
  $ct++;
70
  }
71
+ }
72
+ wppa_echo( '
73
  </tr>
74
  </tbody>
75
  </table>
 
76
  <p>
77
+ <input type="submit" class="button-primary" name="wppa-export-submit" value="' . esc_attr( __( 'Export', 'wp-photo-album-plus' ) ) . '">
78
  </p>
79
  </form>
80
+ </div>' );
81
+
82
  }
83
 
84
  function wppa_export_photos() {
89
 
90
  $wppa_temp_idx = 0;
91
 
92
+ wppa_echo( __( 'Exporting', 'wp-photo-album-plus' ) . '...<br>' );
93
+ wppa_echo( sprintf( __( 'If you do not get a message like "nn Album exported" within %d seconds, your browser may be timed out. In tha case, just redo the export', 'wp-photo-album-plus' ), wppa_time_left() ) );
94
  if ( PHP_VERSION_ID >= 50207 && class_exists('ZipArchive') ) {
95
+ $can_zip = true;
 
 
 
 
 
 
 
 
 
 
 
96
  }
97
  else {
98
+ $can_zip = false;
99
  if ( PHP_VERSION_ID < 50207 ) wppa_warning_message(__('Can export albums and photos, but cannot make a zipfile. Your php version is < 5.2.7.', 'wp-photo-album-plus' ));
100
  if ( ! class_exists('ZipArchive') ) wppa_warning_message(__('Can export albums and photos, but cannot make a zipfile. Your php version does not support ZipArchive.', 'wp-photo-album-plus' ));
101
  }
102
 
103
+ $albums = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums ORDER BY id" );
104
+
105
+ $done = 0;
106
+ $abort = false;
107
+ foreach( $albums as $id ) {
108
+
109
+ // Process this album?
110
+ if ( wppa_get( 'album-' . $id, '0', 'text' ) ) {
111
+
112
+ echo('<br>' . __( 'Opening zip output file...', 'wp-photo-album-plus' ) );
113
+ $wppa_zip = new ZipArchive;
 
 
 
 
 
 
 
 
 
 
 
 
114
 
115
+ $zipfile = WPPA_DEPOT_PATH . '/album-' . $id . '.zip';
116
+ if ( $wppa_zip->open( $zipfile, 1 ) === TRUE ) {
117
+ wppa_echo( sprintf( __( 'ok, <br>Filling %1s with data from album %2s', 'wp-photo-album-plus' ), basename( $zipfile ), wppa_get_album_name( $id ) ) );
118
+ } else {
119
+ wppa_echo( __( 'failed', 'wp-photo-album-plus' ) );
120
+ $wppa_zip = false;
121
+ }
122
+
123
+ wppa_echo( '<br>' . sprintf( __( 'Processing album %d. Time left: %d seconds', 'wp-photo-album-plus' ), $id, wppa_time_left() ) );
124
+ wppa_write_album_file_by_id( $id );
125
+ $photos = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
126
+ WHERE album = %d", $id ), ARRAY_A );
127
+ $cnt = 0;
128
+ foreach ( $photos as $photo ) {
129
+
130
+ // Copy the photo
131
+ $photo_id = strval( intval( $photo['id'] ) );
132
+ $from = wppa_get_photo_path( $photo_id );
133
+ $to = WPPA_DEPOT_PATH . '/' . $photo_id . '.' . $photo['ext'];
134
+
135
+ if ( $wppa_zip ) {
136
+ $wppa_zip->addFile ( $from, basename ( $to ) );
137
+ }
138
+ else wppa_copy ( $from, $to );
139
+
140
+ // Create the metadata
141
+ if ( ! wppa_write_photo_file ( $photo ) ) {
142
+ return false;
143
+ }
144
+ else $cnt++;
145
+
146
+ if ( wppa_is_time_up() ) {
147
+ $abort = true;
148
+ }
149
+
150
+ if ( $abort ) break;
151
+
152
+ $wppa_zip->close();
153
+ $wppa_zip->open( $zipfile );
154
+ }
155
+
156
+ if ( $abort ) {
157
+ wppa_echo( ' ' . __( 'failed.', 'wp-photo-album-plus' ) );
158
+ }
159
+ else {
160
+ wppa_echo( ' '. sprintf( __( 'done. %d photos processed', 'wp-photo-album-plus' ), $cnt ) );
161
+ }
162
+
163
+ if ( $wppa_zip ) {
164
+
165
+ wppa_echo( '<br>' . __( 'Closing zip', 'wp-photo-album-plus' ) );
166
+ $wppa_zip->close();
167
+
168
+ wppa_echo( '<br>' . __( 'Deleting temp files', 'wp-photo-album-plus' ) );
169
+
170
+ // Now the zip is closed we can destroy all tempfiles we created here
171
+ // This may take some time, so skip it when aborted
172
+ if ( ! $abort ) {
173
+ wppa_delete_export_tempfiles();
174
+ }
175
+
176
+ if ( $abort ) {
177
+ if ( wppa_is_file( $zipfile ) ) {
178
+ wppa_unlink( $zipfile );
179
  }
 
180
  }
 
181
  }
182
+
183
+
184
+ if ( ! $abort ) {
185
+ wppa_echo( '
186
+ <br>
187
+ <a
188
+ href="' . esc_attr( WPPA_DEPOT_URL . '/album-' . $id . '.zip' ) . '"
189
+ download="' . esc_attr( wppa_get_album_name( $id ) ) . '">
190
+ <input type="button" class="button-primary" value="' . esc_attr( sprintf( __( 'Download album %s', 'wp-photo-album-plus' ), wppa_get_album_name( $id ) ) ) . '">
191
+ </a>' );
192
+ $done++;
193
+ }
194
+
195
+ if ( wppa_is_time_up() ) break;
196
+
197
  }
198
+
199
+ }
200
+
201
+ if ( !empty( $wppa_temp ) ) {
202
+ $extra = '<br>' . __( 'Not all tempfiles could be removed', 'wp-photo-album-plus' );
203
  }
204
  else {
205
+ $extra = '';
206
  }
207
+ wppa_echo( '<p>' . sprintf( _n( '%d Album exported', '%d Albums exported', $done, 'wp-photo-album-plus' ), $done ) . $extra . '</p>' );
208
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
 
211
  function wppa_write_album_file_by_id($id) {
347
  return false;
348
  }
349
  return true;
350
+ }
351
+
352
+ function wppa_delete_export_tempfiles() {
353
+ global $wppa_temp;
354
+
355
+ if ( is_array( $wppa_temp ) ) {
356
+ foreach ( array_keys( $wppa_temp ) as $key ) {
357
+ $file = $wppa_temp[$key];
358
+ if ( is_file( $file ) ) {
359
+ unlink( $file );
360
+ unset( $wppa_temp[$key] );
361
+ }
362
+ if ( wppa_is_time_up() ) {
363
+ wppa_echo( '<br>' . __( 'Could not remove all temporary files', 'wp-photo-album-plus' ) );
364
+ return false;
365
+ }
366
+ }
367
+ }
368
+ return true;
369
  }
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.2.05.007
7
  *
8
  */
9
 
@@ -832,7 +832,7 @@ global $other_deps;
832
 
833
  // Update searchroot in search boxes
834
  $rt = $wppa_session['search_root'];
835
- if ( ! $rt ) $rt = '0'; // must be non-empty string
836
  wppa_add( 'src_script', 'jQuery(document).ready(function(){wppaUpdateSearchRoot( \'' . esc_js( wppa_display_root( $rt ) ) . '\', \'' . $rt . '\' )});' );
837
 
838
  // If not search forget previous results
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.2.05.008
7
  *
8
  */
9
 
832
 
833
  // Update searchroot in search boxes
834
  $rt = $wppa_session['search_root'];
835
+ if ( ! $rt || wppa_is_enum( $rt ) ) $rt = '0'; // must be non-empty string
836
  wppa_add( 'src_script', 'jQuery(document).ready(function(){wppaUpdateSearchRoot( \'' . esc_js( wppa_display_root( $rt ) ) . '\', \'' . $rt . '\' )});' );
837
 
838
  // If not search forget previous results
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 8.2.05.004
7
  *
8
  */
9
 
@@ -398,7 +398,7 @@ global $wppa_session;
398
  }
399
 
400
  elseif( $source_type == 'realmedia' ) {
401
- wppa_echo( ' '. __( 'Real media plugin defined albums', 'wp-photo-album-plus' ) );
402
  }
403
 
404
  else {
@@ -424,9 +424,9 @@ global $wppa_session;
424
  wppa_echo( '<p>' );
425
 
426
  wppa_echo( __( 'Number of available realmedia albums', 'wp-photo-album-plus' ) . ': ' . $albumcount . '<br>' );
427
- wppa_echo( __( 'Number of imported realmeda albums', 'wp-photo-album-plus' ) . ': ' . $albumsdone . '<br>' );
428
  wppa_echo( __( 'Number of available realmedia files', 'wp-photo-album-plus' ) . ': ' . $filecount . '<br>' );
429
- wppa_echo( __( 'Number of imported realmeda files', 'wp-photo-album-plus' ) . ': ' . $filesdone . '<br>' );
430
 
431
  wppa_echo( '</p>' );
432
  wppa_echo( '
@@ -435,7 +435,7 @@ global $wppa_session;
435
  class="button-primary"
436
  id="submit"
437
  name="wppa-import-realmedia"
438
- value="' . __( 'Import Realmeadia albums and files', 'wp-photo-album-plus' ) . '"
439
  />
440
  </form>' );
441
  }
@@ -3390,7 +3390,7 @@ global $wpdb;
3390
  @ wppa_mktree( $sourcedir );
3391
  if ( ! wppa_is_dir( $sourcedir ) ) {
3392
  wppa_log( 'err', 'Could not create wppa source directory' );
3393
- wppa_echo( '<p style="color:red" >Fatal error: Could not create wppa source directory</p>' );
3394
  return;
3395
  }
3396
  }
@@ -3425,7 +3425,7 @@ global $wpdb;
3425
  $parent = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_albums WHERE rml_id = $rml_parent" );
3426
  if ( ! $parent ) {
3427
  wppa_log( 'err', 'Could not find parent when converting rml album #'.$rml_id );
3428
- wppa_echo( '<p style="color:red" >Could not find parent when converting rml album #'.$rml_id.'</p>' );
3429
  $parent = '0';
3430
  $done = false;
3431
  }
@@ -3444,7 +3444,7 @@ global $wpdb;
3444
  }
3445
 
3446
  // Tell whats done
3447
- wppa_echo("<br>Created album $name with parent id $parent from rml album id $rml_album_id as wppa album id $iret");
3448
  wppa_log( 'obs', "Album $iret created by conversion from realmedialibrary proc" );
3449
  }
3450
  }
@@ -3471,8 +3471,8 @@ global $wpdb;
3471
 
3472
  // Post found?
3473
  if ( ! $wp_post ) {
3474
- wppa_log( 'err', "Attachment $post_id not found while converting file from ealmedialibrary" );
3475
- wppa_echo( '<p style="color:red" >Attachment ' . $post_id . ' not found while convering file from ealmedialibrary</p>' );
3476
  $done = false;
3477
  }
3478
 
@@ -3485,9 +3485,12 @@ global $wpdb;
3485
  // Get the id to see if the files are there
3486
  $files_only = false;
3487
  $id = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_photos WHERE rml_id = $post_id LIMIT 1" );
3488
- $display_file = wppa_get_photo_path( $id );
3489
- if ( $entry_found && wppa_is_file( $display_file ) ) {
3490
- // Do nothing
 
 
 
3491
  }
3492
 
3493
  // Is a new one
@@ -3504,7 +3507,7 @@ global $wpdb;
3504
  $ext = strtolower( wppa_get_ext( $file ) );
3505
 
3506
  if ( $album ) {
3507
- wppa_echo( "<br>Importing $path of type $mime in post $wp_post_id from rml album $rml_album to wppa album $album" );
3508
  $id = '';
3509
 
3510
  // Dispatch on filetype
@@ -3539,7 +3542,7 @@ global $wpdb;
3539
  // Failed
3540
  else {
3541
  wppa_log( 'err', "Could not import $file" );
3542
- wppa_echo( '<p style="color:red">' . "Could not import $file" . '</p>');
3543
  }
3544
  break;
3545
 
@@ -3575,7 +3578,7 @@ global $wpdb;
3575
  // Failed
3576
  else {
3577
  wppa_log( 'err', "Could not import $file" );
3578
- wppa_echo( '<p style="color:red">' . "Could not import $file" . '</p>');
3579
  }
3580
  break;
3581
 
@@ -3618,7 +3621,7 @@ global $wpdb;
3618
  // Failed
3619
  else {
3620
  wppa_log( 'err', "Could not import $file" );
3621
- wppa_echo( '<p style="color:red">' . "Could not import $file" . '</p>');
3622
  }
3623
  break;
3624
 
@@ -3648,7 +3651,7 @@ global $wpdb;
3648
  }
3649
 
3650
  if ( ! $done ) {
3651
- wppa_echo( '<h3 style="color:red;" >' . __( 'Could not import all media items, please restart', 'wp-photo-album-plus' ) . '</h3>' );
3652
  wppa_invalidate_treecounts();
3653
  return;
3654
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 8.2.05.008
7
  *
8
  */
9
 
398
  }
399
 
400
  elseif( $source_type == 'realmedia' ) {
401
+ wppa_echo( ' '. __( 'Realmedia plugin defined albums', 'wp-photo-album-plus' ) );
402
  }
403
 
404
  else {
424
  wppa_echo( '<p>' );
425
 
426
  wppa_echo( __( 'Number of available realmedia albums', 'wp-photo-album-plus' ) . ': ' . $albumcount . '<br>' );
427
+ wppa_echo( __( 'Number of imported realmedia albums', 'wp-photo-album-plus' ) . ': ' . $albumsdone . '<br>' );
428
  wppa_echo( __( 'Number of available realmedia files', 'wp-photo-album-plus' ) . ': ' . $filecount . '<br>' );
429
+ wppa_echo( __( 'Number of imported realmedia files', 'wp-photo-album-plus' ) . ': ' . $filesdone . '<br>' );
430
 
431
  wppa_echo( '</p>' );
432
  wppa_echo( '
435
  class="button-primary"
436
  id="submit"
437
  name="wppa-import-realmedia"
438
+ value="' . __( 'Import realmedia albums and files', 'wp-photo-album-plus' ) . '"
439
  />
440
  </form>' );
441
  }
3390
  @ wppa_mktree( $sourcedir );
3391
  if ( ! wppa_is_dir( $sourcedir ) ) {
3392
  wppa_log( 'err', 'Could not create wppa source directory' );
3393
+ wppa_echo( '<p style="color:red" >' . __( 'Fatal error: Could not create wppa source directory', 'wp-photo-album-plus' ) . '</p>' );
3394
  return;
3395
  }
3396
  }
3425
  $parent = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_albums WHERE rml_id = $rml_parent" );
3426
  if ( ! $parent ) {
3427
  wppa_log( 'err', 'Could not find parent when converting rml album #'.$rml_id );
3428
+ wppa_echo( '<p style="color:red" >' . sprintf( __( 'Could not find parent when converting realmedia album number %d', 'wp-photo-album-plus' ), $rml_id ) .'</p>' );
3429
  $parent = '0';
3430
  $done = false;
3431
  }
3444
  }
3445
 
3446
  // Tell whats done
3447
+ wppa_echo( '<br>' . sprintf( __( 'Created album %1s with parent id %2s from realmedia album id %3s as wppa album id %4s', 'wp-photo-album-plus' ), $name, $parent, $rml_album_id, $iret ) );
3448
  wppa_log( 'obs', "Album $iret created by conversion from realmedialibrary proc" );
3449
  }
3450
  }
3471
 
3472
  // Post found?
3473
  if ( ! $wp_post ) {
3474
+ wppa_log( 'err', "Attachment $post_id not found while converting file from realmedia" );
3475
+ wppa_echo( '<p style="color:red" >' . sprintf( __( 'Attachment %d not found while convering file from realmedia', 'wp-photo-album-plus' ), $post_id ) . '</p>' );
3476
  $done = false;
3477
  }
3478
 
3485
  // Get the id to see if the files are there
3486
  $files_only = false;
3487
  $id = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_photos WHERE rml_id = $post_id LIMIT 1" );
3488
+
3489
+ if ( $entry_found && wppa_is_file( wppa_get_photo_path( $id ) ) ) {
3490
+ // Do nothing, is photo
3491
+ }
3492
+ elseif ( $entry_found && wppa_is_video( $id ) && wppa_is_file( wppa_strip_ext( wppa_get_photo_path( $id ) ) . '.mp4' ) ) {
3493
+ // Do nothung, is video
3494
  }
3495
 
3496
  // Is a new one
3507
  $ext = strtolower( wppa_get_ext( $file ) );
3508
 
3509
  if ( $album ) {
3510
+ wppa_echo( '<br>' . sprintf( __( 'Importing %1s of type %2s in post %3s from rml album %4s to wppa album %5s', 'wp-photo-album-plus' ), $path, $mime, $wp_post_id, $rml_album, $album ) );
3511
  $id = '';
3512
 
3513
  // Dispatch on filetype
3542
  // Failed
3543
  else {
3544
  wppa_log( 'err', "Could not import $file" );
3545
+ wppa_echo( '<p style="color:red">' . sprintf( __( 'Could not import %s', 'wp-photo-album-plus' ), $file ) . '</p>' );
3546
  }
3547
  break;
3548
 
3578
  // Failed
3579
  else {
3580
  wppa_log( 'err', "Could not import $file" );
3581
+ wppa_echo( '<p style="color:red">' . sprintf( __( 'Could not import %s', 'wp-photo-album-plus' ), $file ) . '</p>');
3582
  }
3583
  break;
3584
 
3621
  // Failed
3622
  else {
3623
  wppa_log( 'err', "Could not import $file" );
3624
+ wppa_echo( '<p style="color:red">' . sprintf( __( 'Could not import %s', 'wp-photo-album-plus' ), $file ) . '</p>');
3625
  }
3626
  break;
3627
 
3651
  }
3652
 
3653
  if ( ! $done ) {
3654
+ wppa_echo( '<h3 style="color:red;" >' . __( 'Could not import all realmedia items, please restart', 'wp-photo-album-plus' ) . '</h3>' );
3655
  wppa_invalidate_treecounts();
3656
  return;
3657
  }
wppa-input.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
- * Version 8.2.05.005
7
  *
8
  */
9
 
@@ -432,6 +432,10 @@ global $wpdb;
432
  $result = sanitize_text_field( $_REQUEST[$key] );
433
  break;
434
 
 
 
 
 
435
  default:
436
  wppa_log( 'err', 'Unknown filter for querystring arg = ' . $name . ', value = ' . sanitize_text_field( var_export( $_REQUEST[$key], true ) ) );
437
  $result = sanitize_text_field( $_REQUEST[$key] );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
+ * Version 8.2.05.008
7
  *
8
  */
9
 
432
  $result = sanitize_text_field( $_REQUEST[$key] );
433
  break;
434
 
435
+ case 'textarea':
436
+ $result = esc_textarea( $_REQUEST[$key] );
437
+ break;
438
+
439
  default:
440
  wppa_log( 'err', 'Unknown filter for querystring arg = ' . $name . ', value = ' . sanitize_text_field( var_export( $_REQUEST[$key], true ) ) );
441
  $result = sanitize_text_field( $_REQUEST[$key] );
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 8.2.05.002
7
  *
8
  */
9
 
@@ -831,13 +831,13 @@ global $all_wppa_options;
831
  if ( $all_wppa_options == NULL ) {
832
  $all_wppa_options = wp_load_alloptions();
833
  }
834
-
835
  // Update the option
836
  update_option( $option, $value );
837
 
838
  // Update the local cache
839
  $wppa_opt[$option] = $value;
840
-
841
  // Update the all optins local cache
842
  if ( is_array( $value ) ) {
843
  $all_wppa_options[$option] = serialize( $value );
@@ -1018,16 +1018,16 @@ global $wppa_endtime;
1018
 
1019
  // Not cron, leave a message optionally and retrun true
1020
  if ( $count ) {
1021
- if ( is_admin() ) {
1022
- wppa_warning_message( sprintf( __( 'Time out after processing %s items.', 'wp-photo-album-plus' ), $count ) );
1023
- }
1024
- else {
1025
- wppa_alert( sprintf( __( 'Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus' ), $count ) );
1026
- }
1027
  }
1028
  return true;
1029
  }
1030
 
 
 
 
 
 
1031
  // Update photo modified timestamp
1032
  function wppa_update_modified( $photo ) {
1033
  global $wpdb;
@@ -4951,14 +4951,14 @@ global $all_wppa_options;
4951
  if ( isset( $wppa_defaults[$name] ) ) {
4952
  $default = $wppa_defaults[$name];
4953
  }
4954
-
4955
  // Get all options if not yet done
4956
  if ( $all_wppa_options == NULL ) {
4957
  $all_wppa_options = wp_load_alloptions();
4958
  }
4959
 
4960
  if ( isset( $all_wppa_options[$name] ) ) {
4961
- $result = $all_wppa_options[$name];
4962
  if ( is_serialized( $result ) ) {
4963
  $result = unserialize( $result );
4964
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 8.2.05.008
7
  *
8
  */
9
 
831
  if ( $all_wppa_options == NULL ) {
832
  $all_wppa_options = wp_load_alloptions();
833
  }
834
+
835
  // Update the option
836
  update_option( $option, $value );
837
 
838
  // Update the local cache
839
  $wppa_opt[$option] = $value;
840
+
841
  // Update the all optins local cache
842
  if ( is_array( $value ) ) {
843
  $all_wppa_options[$option] = serialize( $value );
1018
 
1019
  // Not cron, leave a message optionally and retrun true
1020
  if ( $count ) {
1021
+ wppa_alert( sprintf( __( 'Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus' ), $count ) );
 
 
 
 
 
1022
  }
1023
  return true;
1024
  }
1025
 
1026
+ function wppa_time_left() {
1027
+ global $wppa_endtime;
1028
+ return $wppa_endtime - time();
1029
+ }
1030
+
1031
  // Update photo modified timestamp
1032
  function wppa_update_modified( $photo ) {
1033
  global $wpdb;
4951
  if ( isset( $wppa_defaults[$name] ) ) {
4952
  $default = $wppa_defaults[$name];
4953
  }
4954
+
4955
  // Get all options if not yet done
4956
  if ( $all_wppa_options == NULL ) {
4957
  $all_wppa_options = wp_load_alloptions();
4958
  }
4959
 
4960
  if ( isset( $all_wppa_options[$name] ) ) {
4961
+ $result = $all_wppa_options[$name];
4962
  if ( is_serialized( $result ) ) {
4963
  $result = unserialize( $result );
4964
  }
wppa-wrappers.php CHANGED
@@ -5,7 +5,7 @@
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
- * Version 8.2.05.002
9
  *
10
  */
11
 
@@ -755,6 +755,7 @@ static $allowed_tags;
755
  'data-panorama' => true,
756
  'data-pantype' => true,
757
  'box-sizing' => true,
 
758
  ) ),
759
  'aside' => $sa,
760
  'audio' => array_merge( $sa, array(
@@ -802,6 +803,7 @@ static $allowed_tags;
802
  'disabled' => true,
803
  'accept' => true,
804
  'placeholder' => true,
 
805
  ) ),
806
  'label' => array(
807
  'for' => true,
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
+ * Version 8.2.05.008
9
  *
10
  */
11
 
755
  'data-panorama' => true,
756
  'data-pantype' => true,
757
  'box-sizing' => true,
758
+ 'download' => true,
759
  ) ),
760
  'aside' => $sa,
761
  'audio' => array_merge( $sa, array(
803
  'disabled' => true,
804
  'accept' => true,
805
  'placeholder' => true,
806
+ 'download' => true,
807
  ) ),
808
  'label' => array(
809
  'for' => true,
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: 8.2.05.007
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 $wpdb;
23
  global $wp_version;
24
 
25
  /* WPPA Version */
26
- global $wppa_version; $wppa_version = '8.2.05.007'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */
@@ -34,9 +34,9 @@ add_action( 'plugins_loaded', 'wppa_init_timer', '1' );
34
  function wppa_init_timer() {
35
  global $wppa_endtime;
36
 
37
- $met = ini_get( 'max_execution_time' );
38
- if ( $met > 55 && ! wppa_is_cron() && ! defined( 'DOING_WPPA_AJAX' ) ) {
39
- $met = 55;
40
  }
41
  else {
42
  $met -= 5;
@@ -44,6 +44,8 @@ global $wppa_endtime;
44
  if ( $met <= 0 ) {
45
  $met = 25;
46
  }
 
 
47
  $wppa_endtime = time() + $met;
48
  }
49
 
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: 8.2.05.008
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
  global $wp_version;
24
 
25
  /* WPPA Version */
26
+ global $wppa_version; $wppa_version = '8.2.05.008'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */
34
  function wppa_init_timer() {
35
  global $wppa_endtime;
36
 
37
+ $met = intval( ini_get( 'max_execution_time' ) );
38
+ if ( $met > 120 && ! wppa_is_cron() && ! defined( 'DOING_WPPA_AJAX' ) ) {
39
+ $met -= 30;
40
  }
41
  else {
42
  $met -= 5;
44
  if ( $met <= 0 ) {
45
  $met = 25;
46
  }
47
+
48
+ // $met = 30; // debug
49
  $wppa_endtime = time() + $met;
50
  }
51