WP Photo Album Plus - Version 7.0.10.007

Version Description

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

Code changes from version 7.0.10.005 to 7.0.10.007

wppa-common-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
- * Version 7.0.09
6
  *
7
  */
8
 
@@ -1070,7 +1070,7 @@ global $cache_path;
1070
  }
1071
 
1072
  // Remove tempfiles
1073
- wppa_delete_obsolete_tempfiles( true );
1074
  }
1075
 
1076
  // Removes the content of $dir, ignore errors
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.0.10
6
  *
7
  */
8
 
1070
  }
1071
 
1072
  // Remove tempfiles
1073
+ // wppa_delete_obsolete_tempfiles( true );
1074
  }
1075
 
1076
  // Removes the content of $dir, ignore errors
wppa-cron.php CHANGED
@@ -153,6 +153,7 @@ function wppa_schedule_cleanup( $now = false ) {
153
  // The actual cleaner
154
  function wppa_do_cleanup() {
155
  global $wpdb;
 
156
 
157
  // Are we temp disbled?
158
  if ( wppa_switch( 'maint_ignore_cron' ) ) {
@@ -163,9 +164,6 @@ global $wpdb;
163
 
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.' );
@@ -175,7 +173,7 @@ global $wpdb;
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' );
@@ -184,7 +182,7 @@ global $wpdb;
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.' );
@@ -194,7 +192,7 @@ global $wpdb;
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' );
@@ -205,20 +203,12 @@ global $wpdb;
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
217
- $album_ids = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums" );
218
- if ( ! empty( $album_ids ) ) {
219
- $lost = $wpdb->query( "UPDATE $wpdb->wppa_photos SET album = '-9' WHERE album > '0' AND album NOT IN ( " . implode( ',', $album_ids ) . " ) " );
220
- }
221
- */
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 ) );
@@ -226,12 +216,12 @@ global $wpdb;
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' ) ) {
@@ -270,7 +260,7 @@ global $wpdb;
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
  /*
@@ -290,53 +280,22 @@ global $wpdb;
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',
306
- 'commentnotify',
307
- 'commentprevious',
308
- 'moderatephoto',
309
- 'moderatecomment',
310
- 'photoapproved',
311
- 'commentapproved',
312
- );
313
-
314
- while ( $i <= $to && time() < $endtime ) {
315
- foreach( $mailings as $list ) {
316
- if ( substr( $list, 0, 8 ) != 'moderate' || user_can( $i, 'wppa_moderate' ) ) {
317
- wppa_subscribe_user( $i, $list );
318
- }
319
- }
320
- $i++;
321
- }
322
- wppa_log( 'Eml', $to - $from . ' users added to mailinglists' );
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 ) ) {
330
  foreach( $albs as $alb ) {
331
  wppa_update_album( array( 'id' => $alb['id'], 'sname' => wppa_sanitize_album_photo_name( $alb['name'] ) ) );
332
  wppa_log( 'dbg', 'Set sname from ' . $alb['name'] . ' to ' . wppa_sanitize_album_photo_name( $alb['name'] ) . ' for album ' . $alb['id'] );
333
- if ( time() > $endtime ) {
334
  wppa_log( 'Cron', 'Reschedule cleanup' );
335
  wppa_schedule_cleanup( true );
 
336
  }
337
  }
338
  }
339
- wppa_log( 'Cron', 'Phase 10, time left = '.($endtime-time()) );
340
 
341
  // Add url-sanitized names to new photos
342
  $photos = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_photos} WHERE sname = '' AND name <> '' LIMIT 10000", ARRAY_A );
@@ -344,20 +303,21 @@ global $wpdb;
344
  foreach( $photos as $photo ) {
345
  wppa_update_photo( array( 'id' => $photo['id'], 'sname' => wppa_sanitize_album_photo_name( $photo['name'] ) ) );
346
  wppa_log( 'dbg', 'Set sname from ' . $photo['name'] . ' to ' . wppa_sanitize_album_photo_name( $photo['name'] ) . ' for photo ' . $photo['id'] );
347
- if ( time() > $endtime ) {
348
  wppa_log( 'Cron', 'Reschedule cleanup' );
349
  wppa_schedule_cleanup( true );
 
350
  }
351
  }
352
  }
353
- wppa_log( 'Cron', 'Phase 11, time left = '.($endtime-time()) );
354
 
355
  // Cleanup tempfiles
356
  wppa_delete_obsolete_tempfiles();
357
- wppa_log( 'Cron', 'Phase 12, time left = '.($endtime-time()) );
358
 
359
  // Done?
360
- wppa_log( 'Cron', 'Phase 13, time left = '.($endtime-time()) );
361
 
362
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} completed.' );
363
 
@@ -365,7 +325,6 @@ global $wpdb;
365
  if ( $outbuf ) {
366
  wppa_log( 'dbg', 'Cron unexpected output: ' . $outbuf );
367
  }
368
-
369
  }
370
 
371
  // Selectively clear caches
153
  // The actual cleaner
154
  function wppa_do_cleanup() {
155
  global $wpdb;
156
+ global $wppa_endtime;
157
 
158
  // Are we temp disbled?
159
  if ( wppa_switch( 'maint_ignore_cron' ) ) {
164
 
165
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} started.' );
166
 
 
 
 
167
  // Start renew crypt processes if configured socket_accept
168
  if ( wppa_opt( 'crypt_albums_every' ) ) {
169
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} renew albumcrypt.' );
173
  update_option( 'wppa_crypt_albums_lasttimestamp', time() );
174
  }
175
  }
176
+ wppa_log( 'Cron', 'Phase 1, time left = '.($wppa_endtime-time()) );
177
  if ( wppa_opt( 'crypt_photos_every' ) ) {
178
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} renew photocrypt.' );
179
  $last = get_option( 'wppa_crypt_photos_lasttimestamp', '0' );
182
  update_option( 'wppa_crypt_photos_lasttimestamp', time() );
183
  }
184
  }
185
+ wppa_log( 'Cron', 'Phase 2, time left = '.($wppa_endtime-time()) );
186
 
187
  // Cleanup session db table
188
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} cleanup sessions.' );
192
  $purge = time() - $savetime;
193
  $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_session SET status = 'expired' WHERE timestamp < %s", $expire ) );
194
  $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_session WHERE timestamp < %s", $purge ) );
195
+ wppa_log( 'Cron', 'Phase 3, time left = '.($wppa_endtime-time()) );
196
 
197
  // Delete obsolete spam
198
  $spammaxage = wppa_opt( 'spam_maxage' );
203
  $iret = $wpdb->query( $wpdb->prepare( "DELETE FROM $wpdb->wppa_comments WHERE status = 'spam' AND timestamp < %s", $obsolete ) );
204
  if ( $iret ) wppa_update_option( 'wppa_spam_auto_delcount', get_option( 'wppa_spam_auto_delcount', '0' ) + $iret );
205
  }
206
+ wppa_log( 'Cron', 'Phase 4, time left = '.($wppa_endtime-time()) );
207
 
208
  // Re-animate crashed cronjobs
209
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} reanimate cron.' );
210
  wppa_re_animate_cron();
211
+ wppa_log( 'Cron', 'Phase 5, time left = '.($wppa_endtime-time()) );
 
 
 
 
 
 
 
 
212
 
213
  // Remove 'deleted' photos from system
214
  $dels = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album <= '-9' AND modified < " . ( time() - 3600 ) );
216
  wppa_delete_photo( $del );
217
  wppa_log( 'Cron', 'Removed photo {b}' . $del . '{/b} from system' );
218
  }
219
+ wppa_log( 'Cron', 'Phase 6, time left = '.($wppa_endtime-time()) );
220
 
221
  // Re-create permalink htaccess file
222
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} creating pl htaccess.' );
223
  wppa_create_pl_htaccess();
224
+ wppa_log( 'Cron', 'Phase 7, time left = '.($wppa_endtime-time()) );
225
 
226
  // Retry failed mails
227
  if ( wppa_opt( 'retry_mails' ) ) {
260
  // Store updated failed mails
261
  update_option( 'wppa_failed_mails', $failed_mails );
262
  }
263
+ wppa_log( 'Cron', 'Phase 8, time left = '.($wppa_endtime-time()) );
264
 
265
 
266
  /*
280
  }
281
  }
282
  }
283
+ wppa_log( 'Cron', 'Phase 9, time left = '.($wppa_endtime-time()) );
284
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
285
  // Add url-sanitized names to new albums
286
  $albs = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_albums} WHERE sname = ''", ARRAY_A );
287
  if ( ! empty( $albs ) ) {
288
  foreach( $albs as $alb ) {
289
  wppa_update_album( array( 'id' => $alb['id'], 'sname' => wppa_sanitize_album_photo_name( $alb['name'] ) ) );
290
  wppa_log( 'dbg', 'Set sname from ' . $alb['name'] . ' to ' . wppa_sanitize_album_photo_name( $alb['name'] ) . ' for album ' . $alb['id'] );
291
+ if ( wppa_is_time_up() ) {
292
  wppa_log( 'Cron', 'Reschedule cleanup' );
293
  wppa_schedule_cleanup( true );
294
+ wppa_exit();
295
  }
296
  }
297
  }
298
+ wppa_log( 'Cron', 'Phase 10, time left = '.($wppa_endtime-time()) );
299
 
300
  // Add url-sanitized names to new photos
301
  $photos = $wpdb->get_results( "SELECT id, name FROM {$wpdb->wppa_photos} WHERE sname = '' AND name <> '' LIMIT 10000", ARRAY_A );
303
  foreach( $photos as $photo ) {
304
  wppa_update_photo( array( 'id' => $photo['id'], 'sname' => wppa_sanitize_album_photo_name( $photo['name'] ) ) );
305
  wppa_log( 'dbg', 'Set sname from ' . $photo['name'] . ' to ' . wppa_sanitize_album_photo_name( $photo['name'] ) . ' for photo ' . $photo['id'] );
306
+ if ( wppa_is_time_up() ) {
307
  wppa_log( 'Cron', 'Reschedule cleanup' );
308
  wppa_schedule_cleanup( true );
309
+ wppa_exit();
310
  }
311
  }
312
  }
313
+ wppa_log( 'Cron', 'Phase 11, time left = '.($wppa_endtime-time()) );
314
 
315
  // Cleanup tempfiles
316
  wppa_delete_obsolete_tempfiles();
317
+ wppa_log( 'Cron', 'Phase 12, time left = '.($wppa_endtime-time()) );
318
 
319
  // Done?
320
+ wppa_log( 'Cron', 'Phase 13, time left = '.($wppa_endtime-time()) );
321
 
322
  wppa_log( 'Cron', '{b}wppa_cleanup{/b} completed.' );
323
 
325
  if ( $outbuf ) {
326
  wppa_log( 'dbg', 'Cron unexpected output: ' . $outbuf );
327
  }
 
328
  }
329
 
330
  // Selectively clear caches
wppa-functions.php CHANGED
@@ -3084,7 +3084,6 @@ global $wppa_version; // The theme version ( wppa_theme.php )
3084
  global $wppa_microtime;
3085
  global $wppa_microtime_cum;
3086
  global $wppa_err_displayed;
3087
- global $wppa_loadtime;
3088
  global $wppa_initruntimetime;
3089
  static $wppa_numqueries;
3090
  static $auto;
@@ -3138,7 +3137,6 @@ global $blog_id;
3138
  $wppa_microtime = - microtime( true );
3139
  }
3140
  if ( wppa( 'mocc' ) == '1' ) {
3141
- wppa_dbg_msg( 'Plugin load time :'.substr( $wppa_loadtime,0,5 ).'s.' );
3142
  wppa_dbg_msg( 'Init runtime time :'.substr( $wppa_initruntimetime,0,5 ).'s.' );
3143
  wppa_dbg_msg( 'Num queries before wppa :'.get_num_queries() );
3144
  }
3084
  global $wppa_microtime;
3085
  global $wppa_microtime_cum;
3086
  global $wppa_err_displayed;
 
3087
  global $wppa_initruntimetime;
3088
  static $wppa_numqueries;
3089
  static $auto;
3137
  $wppa_microtime = - microtime( true );
3138
  }
3139
  if ( wppa( 'mocc' ) == '1' ) {
 
3140
  wppa_dbg_msg( 'Init runtime time :'.substr( $wppa_initruntimetime,0,5 ).'s.' );
3141
  wppa_dbg_msg( 'Num queries before wppa :'.get_num_queries() );
3142
  }
wppa-mailing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains mailing functions
6
  *
7
- * Version 7.0.09
8
  *
9
  */
10
 
@@ -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( 'Eml', 'Mailinglist {b}' . $type . '{/b} scheduled for run in ' . $delay . ' seconds. Args: ' . $alb . ', ' . $pho . ', ' . $com . ', ' . $url . ', ' . $start );
29
 
30
  }
31
 
@@ -33,9 +33,6 @@ 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
- // 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
 
@@ -56,7 +53,7 @@ global $wpdb;
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 );
@@ -155,7 +152,7 @@ global $wpdb;
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
  }
@@ -217,7 +214,7 @@ global $wpdb;
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
  }
@@ -335,7 +332,7 @@ global $wpdb;
335
  }
336
 
337
  // If time up, reschedule at current user id to run in 15 sec
338
- if ( time() > $endtime ) {
339
  wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
340
  wppa_exit();
341
  }
4
  *
5
  * Contains mailing functions
6
  *
7
+ * Version 7.0.10
8
  *
9
  */
10
 
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} ' . ( $start ? 're-' : '' ) . '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
  // Add new users to default mailing list subscriptions
37
  if ( wppa_opt( 'mailinglist_policy' ) == 'opt-out' ) {
38
 
53
  'commentapproved',
54
  );
55
 
56
+ while ( ! wppa_is_time_up() ) {
57
  foreach( $mailings as $list ) {
58
  if ( substr( $list, 0, 8 ) != 'moderate' || user_can( $i, 'wppa_moderate' ) ) {
59
  wppa_subscribe_user( $i, $list );
152
  }
153
 
154
  // If time up, reschedule at current user id to run in 15 sec
155
+ if ( wppa_is_time_up() ) {
156
  wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
157
  wppa_exit();
158
  }
214
  }
215
 
216
  // If time up, reschedule at current user id to run in 15 sec
217
+ if ( wppa_is_time_up() ) {
218
  wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
219
  wppa_exit();
220
  }
332
  }
333
 
334
  // If time up, reschedule at current user id to run in 15 sec
335
+ if ( wppa_is_time_up() ) {
336
  wppa_schedule_mailinglist( $type, $alb, $pho, $com, $url, $usr, 15 );
337
  wppa_exit();
338
  }
wppa-maintenance.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
- * Version 7.0.09
7
  *
8
  */
9
 
@@ -87,7 +87,7 @@ global $wppa_session;
87
  global $wppa_supported_video_extensions;
88
  global $wppa_supported_audio_extensions;
89
  global $wppa_all_maintenance_slugs;
90
- global $wppa_timestamp_start;
91
 
92
  // Are we temp disbled?
93
  if ( wppa_is_cron() && wppa_switch( 'maint_ignore_cron' ) ) {
@@ -135,7 +135,6 @@ global $wppa_timestamp_start;
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 = '';
@@ -157,15 +156,14 @@ global $wppa_timestamp_start;
157
  $wppa_session[$slug.'_skipped'] = '0';
158
  }
159
 
160
- // wppa_save_session();
161
-
162
  // Pre-processing needed?
163
  if ( $lastid == '0' ) {
 
164
  if ( wppa_is_cron() ) {
165
- wppa_log( 'Cron', '{b}' . $slug . '{/b} started. Allowed runtime: ' . ( $endtime - time() ) . 's. Cron id = ' . wppa_is_cron() );
166
  }
167
  else {
168
- wppa_log( 'Obs', 'Maintenance proc {b}' . $slug . '{/b} started. Allowed runtime: ' . ( $endtime - time() ) . 's.' );
169
  }
170
  switch ( $slug ) {
171
 
@@ -260,17 +258,15 @@ global $wppa_timestamp_start;
260
  break;
261
 
262
  }
263
- // wppa_save_session();
264
  }
265
 
266
  if ( $lastid != '0' ) {
267
  if ( wppa_is_cron() ) {
268
- wppa_log( 'Cron', '{b}' . $slug . '{/b} continued at item # ' . ( $lastid + 1 ) . '. Allowed runtime: ' . ( $endtime - time() ) . 's. Cron id = ' . wppa_is_cron() );
269
  }
270
  }
271
 
272
  // Dispatch on albums / photos / single actions
273
-
274
  switch ( $slug ) {
275
 
276
  case 'wppa_remake_index_albums':
@@ -306,6 +302,7 @@ global $wppa_timestamp_start;
306
  case 'wppa_remake_index_albums':
307
 
308
  if ( wppa_is_cron() ) {
 
309
  wppa_index_add( 'album', $id );
310
  wppa_log( 'Cron', 'Indexed album {b}' . $id . '{/b}' );
311
  }
@@ -347,7 +344,7 @@ global $wppa_timestamp_start;
347
  // Test for timeout / ready
348
  $lastid = $id;
349
  update_option( $slug.'_last', $lastid );
350
- if ( time() > $endtime ) break; // Time out
351
  }
352
  else { // Nothing to do, Done anyway
353
  $lastid = $topid;
@@ -853,7 +850,7 @@ global $wppa_timestamp_start;
853
  update_option( $slug.'_status', 'Cron job' );
854
  }
855
  }
856
- if ( time() > $endtime ) break; // Time out
857
  }
858
  else { // Nothing to do, Done anyway
859
  $lastid = $topid;
@@ -886,7 +883,7 @@ global $wppa_timestamp_start;
886
 
887
  if ( is_array( $albums ) ) foreach( array_keys( $albums ) as $aidx ) {
888
 
889
- if ( time() < ( $endtime + 2 ) ) {
890
  $alb = $albums[$aidx];
891
 
892
  // If album gone, remove it from index
@@ -898,8 +895,6 @@ global $wppa_timestamp_start;
898
  else {
899
  $words = wppa_index_raw_to_words( wppa_index_get_raw_album( $alb ) );
900
  if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
901
- // wppa_log( 'Cron', 'Removed index entry album {b}' . $albums[$aidx] . '{/b} from keyword {b}' . $indexes[$idx]['slug'] . '{/b}' );
902
-
903
  unset( $albums[$aidx] );
904
  }
905
  wppa_cache_album( 'invalidate', $alb ); // Prevent cache overflow
@@ -923,7 +918,7 @@ global $wppa_timestamp_start;
923
  }
924
 
925
  // For some unknown reason this loop does not return used memory. Hence the memory check
926
- if ( ( time() < ( $endtime + 2 ) ) && ( memory_get_usage() < ( 0.9 * wppa_memry_limit() ) ) ) {
927
  $pho = $photos[$pidx];
928
 
929
  // If photo gone, remove it from index
@@ -935,7 +930,6 @@ global $wppa_timestamp_start;
935
  else {
936
  $words = wppa_index_raw_to_words( wppa_index_get_raw_photo( $pho ) );
937
  if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
938
- // wppa_log( 'Cron', 'Removed index entry photo {b}' . $pho . '{/b} from slug {b}' . $indexes[$idx]['slug'] . '{/b}' );
939
  unset( $photos[$pidx] );
940
  }
941
  wppa_cache_thumb( 'invalidate' ); // Prevent cache overflow
@@ -986,7 +980,7 @@ global $wppa_timestamp_start;
986
  }
987
  }
988
 
989
- if ( time() > $endtime ) break;
990
  if ( memory_get_usage() >= ( 0.9 * wppa_memry_limit() ) ) break;
991
  if ( $aborted ) break;
992
  }
@@ -1142,6 +1136,7 @@ global $wppa_timestamp_start;
1142
  else {
1143
  return $errtxt.'||'.$slug.'||'.$status.'||'.$togo.'||'.$reload;
1144
  }
 
1145
  }
1146
 
1147
  function wppa_do_maintenance_popup( $slug ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 7.0.10
7
  *
8
  */
9
 
87
  global $wppa_supported_video_extensions;
88
  global $wppa_supported_audio_extensions;
89
  global $wppa_all_maintenance_slugs;
90
+ global $wppa_endtime;
91
 
92
  // Are we temp disbled?
93
  if ( wppa_is_cron() && wppa_switch( 'maint_ignore_cron' ) ) {
135
  wppa_extend_session();
136
 
137
  // Initialize
 
138
  $chunksize = '1000';
139
  $lastid = strval( intval ( get_option( $slug . '_last', '0' ) ) );
140
  $errtxt = '';
156
  $wppa_session[$slug.'_skipped'] = '0';
157
  }
158
 
 
 
159
  // Pre-processing needed?
160
  if ( $lastid == '0' ) {
161
+ update_option( $slug.'_status', 'Busy' );
162
  if ( wppa_is_cron() ) {
163
+ wppa_log( 'Cron', '{b}' . $slug . '{/b} started. Allowed runtime: ' . ( $wppa_endtime - time() ) . 's. Cron id = ' . wppa_is_cron() );
164
  }
165
  else {
166
+ wppa_log( 'Obs', 'Maintenance proc {b}' . $slug . '{/b} started. Allowed runtime: ' . ( $wppa_endtime - time() ) . 's.' );
167
  }
168
  switch ( $slug ) {
169
 
258
  break;
259
 
260
  }
 
261
  }
262
 
263
  if ( $lastid != '0' ) {
264
  if ( wppa_is_cron() ) {
265
+ wppa_log( 'Cron', '{b}' . $slug . '{/b} continued at item # ' . ( $lastid + 1 ) . '. Allowed runtime: ' . ( $wppa_endtime - time() ) . 's. Cron id = ' . wppa_is_cron() );
266
  }
267
  }
268
 
269
  // Dispatch on albums / photos / single actions
 
270
  switch ( $slug ) {
271
 
272
  case 'wppa_remake_index_albums':
302
  case 'wppa_remake_index_albums':
303
 
304
  if ( wppa_is_cron() ) {
305
+
306
  wppa_index_add( 'album', $id );
307
  wppa_log( 'Cron', 'Indexed album {b}' . $id . '{/b}' );
308
  }
344
  // Test for timeout / ready
345
  $lastid = $id;
346
  update_option( $slug.'_last', $lastid );
347
+ if ( wppa_is_time_up() ) break; // Time out
348
  }
349
  else { // Nothing to do, Done anyway
350
  $lastid = $topid;
850
  update_option( $slug.'_status', 'Cron job' );
851
  }
852
  }
853
+ if ( wppa_is_time_up() ) break; // Time out
854
  }
855
  else { // Nothing to do, Done anyway
856
  $lastid = $topid;
883
 
884
  if ( is_array( $albums ) ) foreach( array_keys( $albums ) as $aidx ) {
885
 
886
+ if ( ! wppa_is_time_up() ) {
887
  $alb = $albums[$aidx];
888
 
889
  // If album gone, remove it from index
895
  else {
896
  $words = wppa_index_raw_to_words( wppa_index_get_raw_album( $alb ) );
897
  if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
 
 
898
  unset( $albums[$aidx] );
899
  }
900
  wppa_cache_album( 'invalidate', $alb ); // Prevent cache overflow
918
  }
919
 
920
  // For some unknown reason this loop does not return used memory. Hence the memory check
921
+ if ( ( ! wppa_is_time_up() ) && ( memory_get_usage() < ( 0.9 * wppa_memry_limit() ) ) ) {
922
  $pho = $photos[$pidx];
923
 
924
  // If photo gone, remove it from index
930
  else {
931
  $words = wppa_index_raw_to_words( wppa_index_get_raw_photo( $pho ) );
932
  if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
 
933
  unset( $photos[$pidx] );
934
  }
935
  wppa_cache_thumb( 'invalidate' ); // Prevent cache overflow
980
  }
981
  }
982
 
983
+ if ( wppa_is_time_up() ) break;
984
  if ( memory_get_usage() >= ( 0.9 * wppa_memry_limit() ) ) break;
985
  if ( $aborted ) break;
986
  }
1136
  else {
1137
  return $errtxt.'||'.$slug.'||'.$status.'||'.$togo.'||'.$reload;
1138
  }
1139
+ wppa_exit();
1140
  }
1141
 
1142
  function wppa_do_maintenance_popup( $slug ) {
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 7.0.09
7
  *
8
  */
9
 
@@ -11038,7 +11038,7 @@ global $wppa_supported_camara_brands;
11038
  val++;
11039
  jQuery( '#wppa-heartbeat' ).val( val );
11040
  wppaAjaxUpdateOptionValue( 'heartbeat', document.getElementById( 'wppa-heartbeat' ) );
11041
- setTimeout( function() { wppaHeartbeat(); }, 15000 );
11042
  }
11043
  wppaHeartbeat();
11044
  </script>
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.0.10
7
  *
8
  */
9
 
11038
  val++;
11039
  jQuery( '#wppa-heartbeat' ).val( val );
11040
  wppaAjaxUpdateOptionValue( 'heartbeat', document.getElementById( 'wppa-heartbeat' ) );
11041
+ setTimeout( function() { wppaHeartbeat(); }, 10000 );
11042
  }
11043
  wppaHeartbeat();
11044
  </script>
wppa-setup.php CHANGED
@@ -596,6 +596,11 @@ global $wppa_error;
596
  }
597
 
598
  if ( $old_rev <= '7010' ) {
 
 
 
 
 
599
  $wpdb->query( "UPDATE $wpdb->wppa_albums SET sname = ''" );
600
  $wpdb->query( "UPDATE $wpdb->wppa_photos SET sname = ''" );
601
  wppa_schedule_cleanup( true );
@@ -1675,7 +1680,7 @@ cursorborder:'2px solid transparent',";
1675
  'wppa_jpeg_quality' => '95',
1676
  'wppa_geo_edit' => 'no',
1677
  'wppa_auto_continue' => 'yes',
1678
- 'wppa_max_execution_time' => '30',
1679
  'wppa_adminbarmenu_admin' => 'yes',
1680
  'wppa_adminbarmenu_frontend' => 'yes',
1681
  'wppa_feed_use_thumb' => 'no',
596
  }
597
 
598
  if ( $old_rev <= '7010' ) {
599
+ $met = ini_get( 'max_execution_time' );
600
+ $wppamet = get_option( 'wppa_max_execution_time', '30' );
601
+ if ( ( $met > 5 ) && $wppamet > ( $met - '5' ) ) {
602
+ update_option( 'wppa_max_execution_time', $met - '5' );
603
+ }
604
  $wpdb->query( "UPDATE $wpdb->wppa_albums SET sname = ''" );
605
  $wpdb->query( "UPDATE $wpdb->wppa_photos SET sname = ''" );
606
  wppa_schedule_cleanup( true );
1680
  'wppa_jpeg_quality' => '95',
1681
  'wppa_geo_edit' => 'no',
1682
  'wppa_auto_continue' => 'yes',
1683
+ 'wppa_max_execution_time' => '25',
1684
  'wppa_adminbarmenu_admin' => 'yes',
1685
  'wppa_adminbarmenu_frontend' => 'yes',
1686
  'wppa_feed_use_thumb' => 'no',
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.09
7
  *
8
  */
9
 
@@ -969,44 +969,42 @@ function wppa_get_imgalt( $id, $lb = false ) {
969
  }
970
 
971
 
972
- function wppa_is_time_up($count = '') {
973
- global $wppa_starttime;
974
 
975
- $timnow = microtime(true);
976
- $laptim = $timnow - $wppa_starttime;
977
 
978
- $maxwppatim = wppa_opt( 'max_execution_time' );
979
- $maxinitim = ini_get('max_execution_time');
 
 
980
 
981
- if ( $maxwppatim && $maxinitim ) $maxtim = min($maxwppatim, $maxinitim);
982
- elseif ( $maxwppatim ) $maxtim = $maxwppatim;
983
- elseif ( $maxinitim ) $maxtim = $maxinitim;
984
- else return false;
985
 
986
- wppa_dbg_msg('Maxtim = '.$maxtim.', elapsed = '.$laptim, 'red');
987
- if ( ! $maxtim ) return false; // No limit or no value
988
- if ( ( $maxtim - $laptim ) > '5' ) return false;
989
  if ( $count ) {
990
  if ( is_admin() ) {
991
- if ( wppa_switch( 'auto_continue') ) {
992
- wppa_warning_message(sprintf(__('Time out after processing %s items.', 'wp-photo-album-plus'), $count));
993
  }
994
  else {
995
- wppa_error_message(sprintf(__('Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus'), $count));
996
  }
997
  }
998
  else {
999
- wppa_alert(sprintf(__('Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus'), $count));
1000
  }
1001
  }
1002
  return true;
1003
  }
1004
 
1005
-
1006
  // Update photo modified timestamp
1007
- function wppa_update_modified($photo) {
1008
  global $wpdb;
1009
- $wpdb->query($wpdb->prepare("UPDATE $wpdb->wppa_photos SET modified = %s WHERE id = %s", time(), $photo));
1010
  }
1011
 
1012
  function wppa_nl_to_txt($text) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.0.10
7
  *
8
  */
9
 
969
  }
970
 
971
 
972
+ function wppa_is_time_up( $count = '' ) {
973
+ global $wppa_endtime;
974
 
975
+ wppa_log( 'Dbg', 'Timeleft = ' . ( $wppa_endtime - time() ) );
 
976
 
977
+ // Time up?
978
+ if ( $wppa_endtime > time() ) {
979
+ return false; // No
980
+ }
981
 
982
+ // Time is up. If cron return silently true
983
+ if ( wppa_is_cron() ) {
984
+ return true;
985
+ }
986
 
987
+ // Not cron, leave a message optionally and retrun true
 
 
988
  if ( $count ) {
989
  if ( is_admin() ) {
990
+ if ( wppa_switch( 'auto_continue' ) ) {
991
+ wppa_warning_message( sprintf( __( 'Time out after processing %s items.', 'wp-photo-album-plus' ), $count ) );
992
  }
993
  else {
994
+ wppa_error_message( sprintf( __( 'Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus' ), $count ) );
995
  }
996
  }
997
  else {
998
+ wppa_alert( sprintf( __( 'Time out after processing %s items. Please restart this operation', 'wp-photo-album-plus' ), $count ) );
999
  }
1000
  }
1001
  return true;
1002
  }
1003
 
 
1004
  // Update photo modified timestamp
1005
+ function wppa_update_modified( $photo ) {
1006
  global $wpdb;
1007
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->wppa_photos SET modified = %s WHERE id = %s", time(), $photo ) );
1008
  }
1009
 
1010
  function wppa_nl_to_txt($text) {
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.10.005
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,12 +23,20 @@ global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7010'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.0.10.005'; // WPPA software version
27
 
28
  /* start timers */
29
- global $wppa_starttime; $wppa_starttime = microtime( true );
30
- global $wppa_loadtime; $wppa_loadtime = - microtime( true );
31
- global $wppa_timestamp_start; $wppa_timestamp_start = time();
 
 
 
 
 
 
 
 
32
 
33
  /* CONSTANTS
34
  /*
@@ -145,7 +153,3 @@ add_action( 'init', 'wppa_admin_bar_init', 12);
145
  /* END SESSION */
146
  add_action( 'shutdown', 'wppa_session_end' );
147
 
148
-
149
-
150
- $wppa_loadtime += microtime(true);
151
-
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.10.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
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7010'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.0.10.007'; // WPPA software version
27
 
28
  /* start timers */
29
+ add_action( 'plugins_loaded', 'wppa_init_timer' );
30
+ function wppa_init_timer() {
31
+ global $wppa_endtime;
32
+ if ( wppa_is_cron() || wppa( 'ajax' ) ) {
33
+ $wppa_endtime = time() + '25';
34
+ }
35
+ else {
36
+ $met = get_option( 'wppa_max_execution_time', '25' );
37
+ $wppa_endtime = time() + $met;
38
+ }
39
+ }
40
 
41
  /* CONSTANTS
42
  /*
153
  /* END SESSION */
154
  add_action( 'shutdown', 'wppa_session_end' );
155