WP Photo Album Plus - Version 7.0.09.009

Version Description

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

Code changes from version 7.0.09.007 to 7.0.09.009

Files changed (7) hide show
  1. wppa-ajax.php +2 -1
  2. wppa-cron.php +28 -9
  3. wppa-functions.php +1 -1
  4. wppa-mailing.php +74 -25
  5. wppa-maintenance.php +1 -15
  6. wppa-users.php +3 -3
  7. wppa.php +2 -2
wppa-ajax.php CHANGED
@@ -2801,7 +2801,8 @@ global $wppa_log_file;
2801
  wppa_ajax_check_range( $value, false, '0', false, __( 'Dislike delete' , 'wp-photo-album-plus') );
2802
  break;
2803
  case 'wppa_max_execution_time':
2804
- wppa_ajax_check_range( $value, false, '0', '900', __( 'Max execution time' , 'wp-photo-album-plus') );
 
2805
  break;
2806
  case 'wppa_cp_points_comment':
2807
  case 'wppa_cp_points_comment_appr':
2801
  wppa_ajax_check_range( $value, false, '0', false, __( 'Dislike delete' , 'wp-photo-album-plus') );
2802
  break;
2803
  case 'wppa_max_execution_time':
2804
+ $ini = ini_get( 'max_execution_time' );
2805
+ wppa_ajax_check_range( $value, false, '5', $ini - 5, __( 'Max execution time' , 'wp-photo-album-plus') );
2806
  break;
2807
  case 'wppa_cp_points_comment':
2808
  case 'wppa_cp_points_comment_appr':
wppa-cron.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
- * Version 7.0.03
7
  *
8
  *
9
  */
@@ -164,47 +164,53 @@ global $wpdb;
164
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} started.' );
165
 
166
  // Init timer
167
- $ini = ini_get( 'max_execution_time' );
168
- if ( ! $ini ) {
169
- $ini = 30;
170
- }
171
- $endtime = time() + $ini - 5;
172
 
173
  // Start renew crypt processes if configured socket_accept
174
  if ( wppa_opt( 'crypt_albums_every' ) ) {
 
175
  $last = get_option( 'wppa_crypt_albums_lasttimestamp', '0' );
176
  if ( $last + wppa_opt( 'crypt_albums_every' ) * 3600 < time() ) {
177
  wppa_schedule_maintenance_proc( 'wppa_crypt_albums' );
178
  update_option( 'wppa_crypt_albums_lasttimestamp', time() );
179
  }
180
  }
 
181
  if ( wppa_opt( 'crypt_photos_every' ) ) {
 
182
  $last = get_option( 'wppa_crypt_photos_lasttimestamp', '0' );
183
  if ( $last + wppa_opt( 'crypt_photos_every' ) * 3600 < time() ) {
184
  wppa_schedule_maintenance_proc( 'wppa_crypt_photos' );
185
  update_option( 'wppa_crypt_photos_lasttimestamp', time() );
186
  }
187
  }
 
188
 
189
  // Cleanup session db table
 
190
  $lifetime = 3600; // Sessions expire after one hour
191
  $savetime = 86400; // Save session data for 24 hour
192
  $expire = time() - $lifetime;
193
  $purge = time() - $savetime;
194
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session SET status = 'expired' WHERE timestamp < %s", $expire ) );
195
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_session WHERE timestamp < %s", $purge ) );
 
196
 
197
  // Delete obsolete spam
198
  $spammaxage = wppa_opt( 'spam_maxage' );
199
  if ( $spammaxage != 'none' ) {
 
200
  $time = time();
201
  $obsolete = $time - $spammaxage;
202
  $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_comments WHERE status = 'spam' AND timestamp < %s", $obsolete ) );
203
  if ( $iret ) wppa_update_option( 'wppa_spam_auto_delcount', get_option( 'wppa_spam_auto_delcount', '0' ) + $iret );
204
  }
 
205
 
206
  // Re-animate crashed cronjobs
 
207
  wppa_re_animate_cron();
 
208
 
209
  /*
210
  // Find lost photos, update their album to -9, meaning trashed
@@ -216,19 +222,23 @@ global $wpdb;
216
 
217
  // Remove 'deleted' photos from system
218
  $dels = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album <= '-9' AND modified < " . ( time() - 3600 ) );
219
- foreach( $dels as $del ) {
220
  wppa_delete_photo( $del );
221
  wppa_log( 'Cron', 'Removed photo {b}' . $del . '{/b} from system' );
222
  }
 
223
 
224
  // Re-create permalink htaccess file
 
225
  wppa_create_pl_htaccess();
 
226
 
227
  // Retry failed mails
228
  if ( wppa_opt( 'retry_mails' ) ) {
229
 
230
  $failed_mails = get_option( 'wppa_failed_mails' );
231
  if ( is_array( $failed_mails ) ) {
 
232
 
233
  foreach( array_keys( $failed_mails ) as $key ) {
234
 
@@ -260,6 +270,8 @@ global $wpdb;
260
  // Store updated failed mails
261
  update_option( 'wppa_failed_mails', $failed_mails );
262
  }
 
 
263
 
264
  /*
265
  // Cleanup iptc and exif
@@ -278,13 +290,16 @@ global $wpdb;
278
  }
279
  }
280
  }
 
281
 
 
282
  // Add new users to default mailing list subscriptions
283
  if ( wppa_opt( 'mailinglist_policy' ) == 'opt-out' ) {
284
 
285
  $from = get_option( 'wppa_mailinglist_highest_user_auto_subscribed', 0 );
286
  $to = $wpdb->get_var( "SELECT ID from {$wpdb->users} ORDER BY ID DESC LIMIT 1" );
287
  if ( $to > $from ) {
 
288
  $i = $from + 1;
289
  $mailings = array( 'newalbumnotify',
290
  'feuploadnotify',
@@ -308,7 +323,7 @@ global $wpdb;
308
  update_option( 'wppa_mailinglist_highest_user_auto_subscribed', $to );
309
  }
310
  }
311
-
312
  // Add url-sanitized names to new albums
313
  $albs = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_albums} WHERE sname = ''", ARRAY_A );
314
  if ( ! empty( $albs ) ) {
@@ -317,8 +332,9 @@ global $wpdb;
317
  wppa_log( 'dbg', 'Set sname from ' . $alb['name'] . ' to ' . wppa_sanitize_album_photo_name( $alb['name'] ) . ' for album ' . $alb['id'] );
318
  }
319
  }
 
320
 
321
- // Add url-sanitized names to new albums
322
  $photos = true;
323
  while ( time() < $endtime && $photos ) {
324
  $photos = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_photos} WHERE sname = '' LIMIT 100", ARRAY_A );
@@ -329,14 +345,17 @@ global $wpdb;
329
  }
330
  }
331
  }
 
332
 
333
  // Cleanup tempfiles
334
  wppa_delete_obsolete_tempfiles();
 
335
 
336
  // Done?
337
  if ( ! empty( $photos ) ) {
338
  wppa_schedule_cleanup( 'now' );
339
  }
 
340
 
341
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} completed.' );
342
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
+ * Version 7.0.09
7
  *
8
  *
9
  */
164
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} started.' );
165
 
166
  // Init timer
167
+ $endtime = time() + wppa_opt( 'max_execution_time' );
 
 
 
 
168
 
169
  // Start renew crypt processes if configured socket_accept
170
  if ( wppa_opt( 'crypt_albums_every' ) ) {
171
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} renew albumcrypt.' );
172
  $last = get_option( 'wppa_crypt_albums_lasttimestamp', '0' );
173
  if ( $last + wppa_opt( 'crypt_albums_every' ) * 3600 < time() ) {
174
  wppa_schedule_maintenance_proc( 'wppa_crypt_albums' );
175
  update_option( 'wppa_crypt_albums_lasttimestamp', time() );
176
  }
177
  }
178
+ wppa_log( 'Cron', 'Phase 1, time left = '.($endtime-time()) );
179
  if ( wppa_opt( 'crypt_photos_every' ) ) {
180
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} renew photocrypt.' );
181
  $last = get_option( 'wppa_crypt_photos_lasttimestamp', '0' );
182
  if ( $last + wppa_opt( 'crypt_photos_every' ) * 3600 < time() ) {
183
  wppa_schedule_maintenance_proc( 'wppa_crypt_photos' );
184
  update_option( 'wppa_crypt_photos_lasttimestamp', time() );
185
  }
186
  }
187
+ wppa_log( 'Cron', 'Phase 2, time left = '.($endtime-time()) );
188
 
189
  // Cleanup session db table
190
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} cleanup sessions.' );
191
  $lifetime = 3600; // Sessions expire after one hour
192
  $savetime = 86400; // Save session data for 24 hour
193
  $expire = time() - $lifetime;
194
  $purge = time() - $savetime;
195
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session SET status = 'expired' WHERE timestamp < %s", $expire ) );
196
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_session WHERE timestamp < %s", $purge ) );
197
+ wppa_log( 'Cron', 'Phase 3, time left = '.($endtime-time()) );
198
 
199
  // Delete obsolete spam
200
  $spammaxage = wppa_opt( 'spam_maxage' );
201
  if ( $spammaxage != 'none' ) {
202
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} cleanup spam.' );
203
  $time = time();
204
  $obsolete = $time - $spammaxage;
205
  $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_comments WHERE status = 'spam' AND timestamp < %s", $obsolete ) );
206
  if ( $iret ) wppa_update_option( 'wppa_spam_auto_delcount', get_option( 'wppa_spam_auto_delcount', '0' ) + $iret );
207
  }
208
+ wppa_log( 'Cron', 'Phase 4, time left = '.($endtime-time()) );
209
 
210
  // Re-animate crashed cronjobs
211
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} reanimate cron.' );
212
  wppa_re_animate_cron();
213
+ wppa_log( 'Cron', 'Phase 5, time left = '.($endtime-time()) );
214
 
215
  /*
216
  // Find lost photos, update their album to -9, meaning trashed
222
 
223
  // Remove 'deleted' photos from system
224
  $dels = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album <= '-9' AND modified < " . ( time() - 3600 ) );
225
+ if ( !empty( $dels ) ) foreach( $dels as $del ) {
226
  wppa_delete_photo( $del );
227
  wppa_log( 'Cron', 'Removed photo {b}' . $del . '{/b} from system' );
228
  }
229
+ wppa_log( 'Cron', 'Phase 6, time left = '.($endtime-time()) );
230
 
231
  // Re-create permalink htaccess file
232
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} creating pl htaccess.' );
233
  wppa_create_pl_htaccess();
234
+ wppa_log( 'Cron', 'Phase 7, time left = '.($endtime-time()) );
235
 
236
  // Retry failed mails
237
  if ( wppa_opt( 'retry_mails' ) ) {
238
 
239
  $failed_mails = get_option( 'wppa_failed_mails' );
240
  if ( is_array( $failed_mails ) ) {
241
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} retrying failed mails.' );
242
 
243
  foreach( array_keys( $failed_mails ) as $key ) {
244
 
270
  // Store updated failed mails
271
  update_option( 'wppa_failed_mails', $failed_mails );
272
  }
273
+ wppa_log( 'Cron', 'Phase 8, time left = '.($endtime-time()) );
274
+
275
 
276
  /*
277
  // Cleanup iptc and exif
290
  }
291
  }
292
  }
293
+ wppa_log( 'Cron', 'Phase 9, time left = '.($endtime-time()) );
294
 
295
+ /*
296
  // Add new users to default mailing list subscriptions
297
  if ( wppa_opt( 'mailinglist_policy' ) == 'opt-out' ) {
298
 
299
  $from = get_option( 'wppa_mailinglist_highest_user_auto_subscribed', 0 );
300
  $to = $wpdb->get_var( "SELECT ID from {$wpdb->users} ORDER BY ID DESC LIMIT 1" );
301
  if ( $to > $from ) {
302
+ wppa_log( 'Cron', '{b}wppa_cleanup{/b} adding users to mailinlists.' );
303
  $i = $from + 1;
304
  $mailings = array( 'newalbumnotify',
305
  'feuploadnotify',
323
  update_option( 'wppa_mailinglist_highest_user_auto_subscribed', $to );
324
  }
325
  }
326
+ */
327
  // Add url-sanitized names to new albums
328
  $albs = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_albums} WHERE sname = ''", ARRAY_A );
329
  if ( ! empty( $albs ) ) {
332
  wppa_log( 'dbg', 'Set sname from ' . $alb['name'] . ' to ' . wppa_sanitize_album_photo_name( $alb['name'] ) . ' for album ' . $alb['id'] );
333
  }
334
  }
335
+ wppa_log( 'Cron', 'Phase 10, time left = '.($endtime-time()) );
336
 
337
+ // Add url-sanitized names to new photos
338
  $photos = true;
339
  while ( time() < $endtime && $photos ) {
340
  $photos = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_photos} WHERE sname = '' LIMIT 100", ARRAY_A );
345
  }
346
  }
347
  }
348
+ wppa_log( 'Cron', 'Phase 11, time left = '.($endtime-time()) );
349
 
350
  // Cleanup tempfiles
351
  wppa_delete_obsolete_tempfiles();
352
+ wppa_log( 'Cron', 'Phase 12, time left = '.($endtime-time()) );
353
 
354
  // Done?
355
  if ( ! empty( $photos ) ) {
356
  wppa_schedule_cleanup( 'now' );
357
  }
358
+ wppa_log( 'Cron', 'Phase 13, time left = '.($endtime-time()) );
359
 
360
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} completed.' );
361
 
wppa-functions.php CHANGED
@@ -2485,7 +2485,7 @@ global $wppa_done;
2485
  wppa_log( 'Com', 'Comment {i}' . $comment . '{/i} marked as spam' );
2486
  break;
2487
  case 'approved':
2488
- wppa_log( 'Com', 'Comment {i}' . $comment . '{/i} approved' );
2489
  break;
2490
  }
2491
  }
2485
  wppa_log( 'Com', 'Comment {i}' . $comment . '{/i} marked as spam' );
2486
  break;
2487
  case 'approved':
2488
+ wppa_log( 'Com', 'Comment {i}' . $comment . '{/i} added with status approved' );
2489
  break;
2490
  }
2491
  }
wppa-mailing.php CHANGED
@@ -25,7 +25,7 @@ add_action( 'wppa_do_mailinglist_cron', 'wppa_do_mailinglist', 10, 6 );
25
  function wppa_schedule_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url = '', $start = 0, $delay = 120 ) {
26
 
27
  wp_schedule_single_event( time() + $delay, 'wppa_do_mailinglist_cron', array( $type, $alb, $pho, $com, $url, $start ) );
28
- wppa_log( 'cron', 'Mailinglist {b}' . $type . '{/b} scheduled for run in ' . $delay . ' seconds. Args: ' . $alb . ', ' . $pho . ', ' . $com . ', ' . $url . ', ' . $start );
29
 
30
  }
31
 
@@ -33,9 +33,49 @@ function wppa_schedule_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url =
33
  function wppa_do_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url = '', $start = 0 ) {
34
  global $wpdb;
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
  // Mailinglist enabled?
37
  if ( ! wppa_switch( $type ) ) {
38
- return;
39
  }
40
 
41
  // Get mailinglist user ids
@@ -44,12 +84,11 @@ global $wpdb;
44
 
45
  // Mailinglist empty?
46
  if ( empty( $userarray ) ) {
47
- return;
48
  }
49
 
50
- if ( wppa_is_cron() ) {
51
- wppa_log( 'Cron', 'Doing mailing ' . $type . ' for ' . count( $userarray ) . ' recipients' );
52
- }
53
 
54
  // Dispatch on type of mailinglist
55
  switch( $type ) {
@@ -59,7 +98,8 @@ global $wpdb;
59
  // If album removed, quit
60
  $album = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->wppa_albums} WHERE id = %d", $alb ), ARRAY_A );
61
  if ( ! $album ) {
62
- return;
 
63
  }
64
 
65
  // Get the album items we need
@@ -114,9 +154,9 @@ global $wpdb;
114
  wppa_unsubscribe_all( $usr );
115
  }
116
 
117
- // If time up, reschedule at current user id to run in 60 sec
118
- if ( wppa_is_time_up() ) {
119
- wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 60 );
120
  wppa_exit();
121
  }
122
  }
@@ -129,7 +169,7 @@ global $wpdb;
129
  // If moderation required, do the moderatephoto mailing
130
  if ( wppa_get_photo_item( $pho, 'status' ) == 'pending' ) {
131
  wppa_schedule_mailinglist( 'moderatephoto', $alb, $pho, $com, $url );
132
- return;
133
  }
134
 
135
  // The subject
@@ -176,9 +216,9 @@ global $wpdb;
176
  wppa_unsubscribe_all( $usr );
177
  }
178
 
179
- // If time up, reschedule at current user id to run in 60 sec
180
- if ( wppa_is_time_up() ) {
181
- wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 60 );
182
  wppa_exit();
183
  }
184
  }
@@ -198,6 +238,8 @@ global $wpdb;
198
 
199
  // Get the photo owner
200
  $owner = wppa_get_photo_item( $pho, 'owner' );
 
 
201
 
202
  // Get the photos album
203
  if ( ! $alb ) {
@@ -241,15 +283,21 @@ global $wpdb;
241
 
242
  if ( $usr > $start ) {
243
 
 
 
 
 
244
  // Get the user data
245
  $user = get_user_by( 'ID', $usr );
246
 
247
  // If user exists && ( ! owner_and_admin_only || owner || admin || moderator || superuser )
248
  if ( $user ) {
 
249
  if ( ! wppa_switch( 'commentnotify_limit' ) ||
250
  $user->user_login == $owner ||
251
  user_can( $user, 'administrator' ) ||
252
- user_can( $user, 'wppa_moderate' )
 
253
  ) {
254
  wppa_send_mail( array( 'to' => $user->user_email,
255
  'subj' => $subj,
@@ -260,15 +308,15 @@ global $wpdb;
260
  ));
261
  }
262
  }
263
-
264
  // User does not exist, remove him from all lists
265
  else {
266
  wppa_unsubscribe_all( $usr );
267
  }
268
 
269
- // If time up, reschedule at current user id to run in 60 sec
270
- if ( wppa_is_time_up() ) {
271
- wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 60 );
272
  wppa_exit();
273
  }
274
  }
@@ -284,7 +332,8 @@ global $wpdb;
284
  // To who?
285
  $user = get_user_by( 'login', wppa_get_photo_item( $pho, 'owner' ) );
286
  if ( ! $user ) {
287
- return;
 
288
  }
289
  $usr = $user->ID;
290
 
@@ -444,7 +493,8 @@ global $wpdb;
444
 
445
  // Any users left?
446
  if ( empty( $users ) ) {
447
- return;
 
448
  }
449
 
450
  // The callback url if any
@@ -614,12 +664,11 @@ global $wpdb;
614
  break;
615
 
616
  default:
617
- wppa_log( 'Err', 'Unimplemented mailinglist type found: ' . $type, true );
618
  }
619
 
620
- if ( wppa_is_cron() ) {
621
- wppa_log( 'Cron', 'Done mailing ' . $type );
622
- }
623
  }
624
 
625
  // Is current user in mailinglist?
25
  function wppa_schedule_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url = '', $start = 0, $delay = 120 ) {
26
 
27
  wp_schedule_single_event( time() + $delay, 'wppa_do_mailinglist_cron', array( $type, $alb, $pho, $com, $url, $start ) );
28
+ wppa_log( 'Eml', 'Mailinglist {b}' . $type . '{/b} scheduled for run in ' . $delay . ' seconds. Args: ' . $alb . ', ' . $pho . ', ' . $com . ', ' . $url . ', ' . $start );
29
 
30
  }
31
 
33
  function wppa_do_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url = '', $start = 0 ) {
34
  global $wpdb;
35
 
36
+ // Run max .. sec
37
+ $endtime = time() + wppa_opt( 'max_execution_time' );
38
+
39
+ // Add new users to default mailing list subscriptions
40
+ if ( wppa_opt( 'mailinglist_policy' ) == 'opt-out' ) {
41
+
42
+ $from = get_option( 'wppa_mailinglist_highest_user_auto_subscribed', 0 );
43
+ $to = $wpdb->get_var( "SELECT ID from {$wpdb->users} ORDER BY ID DESC LIMIT 1" );
44
+
45
+ if ( $to > $from ) {
46
+
47
+ wppa_log( 'Eml', 'Start adding users to mailinlists' );
48
+ $i = $from + 1;
49
+ $mailings = array( 'newalbumnotify',
50
+ 'feuploadnotify',
51
+ 'commentnotify',
52
+ 'commentprevious',
53
+ 'moderatephoto',
54
+ 'moderatecomment',
55
+ 'photoapproved',
56
+ 'commentapproved',
57
+ );
58
+
59
+ while ( $i <= $to && time() < $endtime ) {
60
+ foreach( $mailings as $list ) {
61
+ if ( substr( $list, 0, 8 ) != 'moderate' || user_can( $i, 'wppa_moderate' ) ) {
62
+ wppa_subscribe_user( $i, $list );
63
+ }
64
+ }
65
+ $i++;
66
+ }
67
+ wppa_log( 'Eml', $to - $from . ' users added to mailinglists' );
68
+ update_option( 'wppa_mailinglist_highest_user_auto_subscribed', $to );
69
+
70
+ // Redo the mailing
71
+ wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $start, 15 );
72
+ wppa_exit();
73
+ }
74
+ }
75
+
76
  // Mailinglist enabled?
77
  if ( ! wppa_switch( $type ) ) {
78
+ wppa_exit();
79
  }
80
 
81
  // Get mailinglist user ids
84
 
85
  // Mailinglist empty?
86
  if ( empty( $userarray ) ) {
87
+ wppa_exit();
88
  }
89
 
90
+ // Log we are in
91
+ wppa_log( 'Eml', 'Doing mailing {b}' . $type . '{/b} for ' . count( $userarray ) . ' recipients. Starting id = ' . $start );
 
92
 
93
  // Dispatch on type of mailinglist
94
  switch( $type ) {
98
  // If album removed, quit
99
  $album = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM {$wpdb->wppa_albums} WHERE id = %d", $alb ), ARRAY_A );
100
  if ( ! $album ) {
101
+ wppa_log( 'Eml', 'Mailing skipped: album ' . $alb . ' vanished' );
102
+ wppa_exit();
103
  }
104
 
105
  // Get the album items we need
154
  wppa_unsubscribe_all( $usr );
155
  }
156
 
157
+ // If time up, reschedule at current user id to run in 15 sec
158
+ if ( time() > $endtime ) {
159
+ wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
160
  wppa_exit();
161
  }
162
  }
169
  // If moderation required, do the moderatephoto mailing
170
  if ( wppa_get_photo_item( $pho, 'status' ) == 'pending' ) {
171
  wppa_schedule_mailinglist( 'moderatephoto', $alb, $pho, $com, $url );
172
+ wppa_exit();
173
  }
174
 
175
  // The subject
216
  wppa_unsubscribe_all( $usr );
217
  }
218
 
219
+ // If time up, reschedule at current user id to run in 15 sec
220
+ if ( time() > $endtime ) {
221
+ wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
222
  wppa_exit();
223
  }
224
  }
238
 
239
  // Get the photo owner
240
  $owner = wppa_get_photo_item( $pho, 'owner' );
241
+ $owuser=get_user_by('login',$owner);
242
+ wppa_log('Eml', 'Owner login = '.$owner.', user id = '.$owuser->ID);
243
 
244
  // Get the photos album
245
  if ( ! $alb ) {
283
 
284
  if ( $usr > $start ) {
285
 
286
+ if ( $usr % 1000 == 0 ) {
287
+ wppa_log('ERR', 'This is not an error but a diagnostic! milestone {b}'.$type.'{/b} '.$usr);
288
+ }
289
+
290
  // Get the user data
291
  $user = get_user_by( 'ID', $usr );
292
 
293
  // If user exists && ( ! owner_and_admin_only || owner || admin || moderator || superuser )
294
  if ( $user ) {
295
+ if($user->user_login == $owner)wppa_log('Eml', 'Sending to: Owner == User: '.$owner);
296
  if ( ! wppa_switch( 'commentnotify_limit' ) ||
297
  $user->user_login == $owner ||
298
  user_can( $user, 'administrator' ) ||
299
+ user_can( $user, 'wppa_moderate' ) ||
300
+ wppa_is_user_superuser( $owner )
301
  ) {
302
  wppa_send_mail( array( 'to' => $user->user_email,
303
  'subj' => $subj,
308
  ));
309
  }
310
  }
311
+
312
  // User does not exist, remove him from all lists
313
  else {
314
  wppa_unsubscribe_all( $usr );
315
  }
316
 
317
+ // If time up, reschedule at current user id to run in 15 sec
318
+ if ( time() > $endtime ) {
319
+ wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
320
  wppa_exit();
321
  }
322
  }
332
  // To who?
333
  $user = get_user_by( 'login', wppa_get_photo_item( $pho, 'owner' ) );
334
  if ( ! $user ) {
335
+ wppa_log( 'Eml', 'Mailing skipped: user ' . wppa_get_photo_item( $pho, 'owner' ) . ' vanished' );
336
+ wppa_exit();
337
  }
338
  $usr = $user->ID;
339
 
493
 
494
  // Any users left?
495
  if ( empty( $users ) ) {
496
+ wppa_log( 'Eml', 'No items for commentprevious mailing' );
497
+ wppa_exit();
498
  }
499
 
500
  // The callback url if any
664
  break;
665
 
666
  default:
667
+ wppa_log( 'Err', 'Unimplemented mailinglist type found: {b}' . $type . '{/b}', true );
668
  }
669
 
670
+ wppa_log( 'Eml', 'Done mailing {b}' . $type . '{/b}' );
671
+ wppa_exit();
 
672
  }
673
 
674
  // Is current user in mailinglist?
wppa-maintenance.php CHANGED
@@ -135,21 +135,7 @@ global $wppa_timestamp_start;
135
  wppa_extend_session();
136
 
137
  // Initialize
138
- if ( wppa_is_cron() ) {
139
- $ini = ini_get( 'max_execution_time' );
140
- if ( ! $ini ) {
141
- $ini = 30;
142
- }
143
- if ( $wppa_timestamp_start ) {
144
- $endtime = $wppa_timestamp_start + $ini - 5;
145
- }
146
- else {
147
- $endtime = time() + 5;
148
- }
149
- }
150
- else {
151
- $endtime = time() + 5;
152
- }
153
  $chunksize = '1000';
154
  $lastid = strval( intval ( get_option( $slug . '_last', '0' ) ) );
155
  $errtxt = '';
135
  wppa_extend_session();
136
 
137
  // Initialize
138
+ $endtime = time() + wppa_opt( 'max_execution_time' );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
139
  $chunksize = '1000';
140
  $lastid = strval( intval ( get_option( $slug . '_last', '0' ) ) );
141
  $errtxt = '';
wppa-users.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
- * Version 6.9.21
7
  *
8
  */
9
 
@@ -261,9 +261,9 @@ static $result = -1;
261
  return in_array( $user, $blacklist );
262
  }
263
 
264
- function wppa_is_user_superuser() {
265
 
266
- $login = wppa_get_user();
267
 
268
  $superlist = get_option( 'wppa_super_users', array() );
269
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
+ * Version 7.0.09
7
  *
8
  */
9
 
261
  return in_array( $user, $blacklist );
262
  }
263
 
264
+ function wppa_is_user_superuser( $user = '' ) {
265
 
266
+ $login = $user ? $user : wppa_get_user();
267
 
268
  $superlist = get_option( 'wppa_super_users', array() );
269
 
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.09.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 $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7009'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.0.09.007'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime( true );
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
+ * Version: 7.0.09.009
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 = '7009'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.0.09.009'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime( true );