WP Photo Album Plus - Version 8.2.06.005

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

Code changes from version 8.2.06.004 to 8.2.06.005

changelog.txt CHANGED
@@ -3,6 +3,8 @@ WP Photo Album Plus Changelog
3
  = 8.2.06 =
4
 
5
  * Export page enhanced.
 
 
6
 
7
  = 8.2.05 =
8
 
3
  = 8.2.06 =
4
 
5
  * Export page enhanced.
6
+ * Fixed mail system problems due to issues with the php function array_merge() that occurred only under special configurations i.e. commentnotify owner and admin only.
7
+ * Subsearch did not work anymore, fixed.
8
 
9
  = 8.2.05 =
10
 
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.06.003
7
  *
8
  */
9
 
@@ -226,7 +226,10 @@ global $wppa_temp_idx;
226
  $wppa_temp_idx = 0;
227
 
228
  wppa_echo( __( 'Exporting', 'wp-photo-album-plus' ) . '...<br>' );
229
- wppa_echo( sprintf( __( 'If you do not get a message like "nn Albums exported" within %d seconds, your browser may be timed out. In that case, just redo the export', 'wp-photo-album-plus' ), wppa_time_left() ) );
 
 
 
230
  if ( PHP_VERSION_ID >= 50207 && class_exists('ZipArchive') ) {
231
  $can_zip = true;
232
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
+ * Version 8.2.06.005
7
  *
8
  */
9
 
226
  $wppa_temp_idx = 0;
227
 
228
  wppa_echo( __( 'Exporting', 'wp-photo-album-plus' ) . '...<br>' );
229
+
230
+ $expected_endtime = wppa_local_date( 'h:i:s', time() + wppa_time_left() );
231
+
232
+ wppa_echo( sprintf( __( 'If you do not get a message like "nn Albums exported" within %d seconds, your browser may be timed out. In that case, just redo the export after %s', 'wp-photo-album-plus' ), wppa_time_left(), $expected_endtime ) );
233
  if ( PHP_VERSION_ID >= 50207 && class_exists('ZipArchive') ) {
234
  $can_zip = true;
235
  }
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.2.05.008
7
  *
8
  */
9
 
@@ -800,10 +800,10 @@ global $other_deps;
800
  if ( wppa( 'src' ) ) {
801
 
802
  // Is the subsearch box checked?
803
- wppa( 'is_subsearch', wppa_get( 'subsearch' ) || wppa_get( 'subsearch' ) );
804
 
805
  // Is the rootsearch box checked?
806
- wppa( 'is_rootsearch', wppa_get( 'rootsearch' ) || wppa_get( 'rootsearch' ) );
807
 
808
  // Is it even a forced root search?
809
  if ( wppa_get( 'forceroot' ) ) {
@@ -1228,14 +1228,36 @@ global $albums_used;
1228
  wppa_cache_album( 'add', $albums );
1229
  }
1230
 
1231
- wppa( 'album_count', ( $albums ? count( $albums ) : 0 ) );
 
1232
 
1233
- // Save ids for caching
1234
- foreach ( $albums as $a ) {
1235
- $albums_used .= '.' . $a['id'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1236
  }
1237
 
1238
- return $albums;
 
 
1239
  }
1240
 
1241
  // loop thumbs
@@ -2137,6 +2159,7 @@ global $wpdb;
2137
  function wppa_do_get_thumbs_query( $query ) {
2138
  global $wpdb;
2139
  global $photos_used;
 
2140
 
2141
  // Anything to do here?
2142
  if ( ! $query ) {
@@ -2218,21 +2241,41 @@ global $photos_used;
2218
  wppa_extended_duplicate_remove( $thumbs );
2219
  }
2220
 
2221
- // Postprocess
2222
- wppa( 'thumb_count', $count );
2223
- $time += microtime( true );
2224
-
2225
  if ( $caching ) {
2226
  wppa_cache_photo( 'add', $thumbs );
2227
  }
2228
  wppa( 'any', ! empty ( $thumbs ) );
2229
 
2230
- // Save ids for caching
2231
- foreach ( $thumbs as $t ) {
2232
- $photos_used .= '.' . $t['id'];
 
 
 
 
 
 
2233
  }
2234
 
2235
- return $thumbs;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2236
  }
2237
 
2238
  // Strip void albums from array
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.2.06.005
7
  *
8
  */
9
 
800
  if ( wppa( 'src' ) ) {
801
 
802
  // Is the subsearch box checked?
803
+ wppa( 'is_subsearch', wppa_get( 'subsearch', '', 'text' ) );
804
 
805
  // Is the rootsearch box checked?
806
+ wppa( 'is_rootsearch', wppa_get( 'rootsearch', '', 'text' ) );
807
 
808
  // Is it even a forced root search?
809
  if ( wppa_get( 'forceroot' ) ) {
1228
  wppa_cache_album( 'add', $albums );
1229
  }
1230
 
1231
+ // Get the ids for search admin
1232
+ $result_ids_a = array_column( $albums, 'id' );
1233
 
1234
+ // Post process for subsearch
1235
+ if ( wppa( 'is_subsearch' ) ) {
1236
+ $found_before_a = explode( '.', wppa_expand_enum( $wppa_session['search_albums'] ) );
1237
+ if ( $found_before_a ) {
1238
+ $result_ids_a = array_intersect( $found_before_a, $result_ids_a );
1239
+ }
1240
+ }
1241
+
1242
+ // Save ids for page caching
1243
+ $albums_used .= '.' . implode( '.', $result_ids_a );
1244
+
1245
+ // If searching, save result ids in session for possible subsearch
1246
+ if ( wppa( 'src' ) ) {
1247
+ $wppa_session['search_albums'] = wppa_compress_enum( implode( '.', $result_ids_a ) );
1248
+ }
1249
+
1250
+ // Setup the final result array of photo data
1251
+ $the_result_a = array();
1252
+ foreach( $albums as $album ) {
1253
+ if ( in_array( $album['id'], $result_ids_a ) ) {
1254
+ $the_result_a[] = $album;
1255
+ }
1256
  }
1257
 
1258
+ wppa( 'album_count', ( $the_result_a ? count( $the_result_a ) : 0 ) );
1259
+
1260
+ return $the_result_a;
1261
  }
1262
 
1263
  // loop thumbs
2159
  function wppa_do_get_thumbs_query( $query ) {
2160
  global $wpdb;
2161
  global $photos_used;
2162
+ global $wppa_session;
2163
 
2164
  // Anything to do here?
2165
  if ( ! $query ) {
2241
  wppa_extended_duplicate_remove( $thumbs );
2242
  }
2243
 
2244
+ // Pre-cache
 
 
 
2245
  if ( $caching ) {
2246
  wppa_cache_photo( 'add', $thumbs );
2247
  }
2248
  wppa( 'any', ! empty ( $thumbs ) );
2249
 
2250
+ // Get the ids for search admin
2251
+ $result_ids_a = array_column( $thumbs, 'id' );
2252
+
2253
+ // Post process for subsearch
2254
+ if ( wppa( 'is_subsearch' ) ) {
2255
+ $found_before_a = explode( '.', wppa_expand_enum( $wppa_session['search_photos'] ) );
2256
+ if ( $found_before_a ) {
2257
+ $result_ids_a = array_intersect( $found_before_a, $result_ids_a );
2258
+ }
2259
  }
2260
 
2261
+ // Save ids for page caching
2262
+ $photos_used .= '.' . implode( '.', $result_ids_a );
2263
+
2264
+ // If searching, save result ids in session for possible subsearch
2265
+ if ( wppa( 'src' ) ) {
2266
+ $wppa_session['search_photos'] = wppa_compress_enum( implode( '.', $result_ids_a ) );
2267
+ }
2268
+
2269
+ // Setup the final result array of photo data
2270
+ $the_result_a = array();
2271
+ foreach( $thumbs as $thumb ) {
2272
+ if ( in_array( $thumb['id'], $result_ids_a ) ) {
2273
+ $the_result_a[] = $thumb;
2274
+ }
2275
+ }
2276
+
2277
+ wppa( 'thumb_count', count( $the_result_a ) );
2278
+ return $the_result_a;
2279
  }
2280
 
2281
  // Strip void albums from array
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.008
7
  *
8
  */
9
 
@@ -236,6 +236,8 @@ function wppa_get_get_filter( $name ) {
236
  case 'import-set-source-url':
237
  case 'caldate':
238
  case 'shortcode':
 
 
239
  $result = 'text';
240
  break;
241
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions for sanitizing and formatting user input
6
+ * Version 8.2.06.005
7
  *
8
  */
9
 
236
  case 'import-set-source-url':
237
  case 'caldate':
238
  case 'shortcode':
239
+ case 'subsearch':
240
+ case 'rootsearch':
241
  $result = 'text';
242
  break;
243
 
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 8.2.06.004
7
  *
8
  */
9
 
@@ -153,10 +153,10 @@ global $wppa_endtime;
153
  if ( $lastid == '0' ) {
154
  wppa_update_option( $slug.'_status', 'Busy' );
155
  if ( wppa_is_cron() ) {
156
- wppa_log( 'Cron', '{b}' . $slug . '{/b} started. Allowed runtime: ' . ( $wppa_endtime - time() ) . 's.' );
157
  }
158
  else {
159
- wppa_log( 'Obs', 'Maintenance proc {b}' . $slug . '{/b} started. Allowed runtime: ' . ( $wppa_endtime - time() ) . 's.' );
160
  }
161
  switch ( $slug ) {
162
 
@@ -255,8 +255,8 @@ global $wppa_endtime;
255
  }
256
 
257
  if ( $lastid != '0' ) {
258
- if ( wppa_is_cron() ) {
259
- wppa_log( 'Cron', '{b}' . $slug . '{/b} continued at item # ' . ( $lastid + 1 ) . '. Allowed runtime: ' . ( $wppa_endtime - time() ) . 's.' );
260
  }
261
  }
262
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 8.2.06.005
7
  *
8
  */
9
 
153
  if ( $lastid == '0' ) {
154
  wppa_update_option( $slug.'_status', 'Busy' );
155
  if ( wppa_is_cron() ) {
156
+ wppa_log( 'Cron', '{b}' . $slug . '{/b} started. Allowed runtime: ' . wppa_time_left() . 's.' );
157
  }
158
  else {
159
+ wppa_log( 'Obs', 'Maintenance proc {b}' . $slug . '{/b} started. Allowed runtime: ' . wppa_time_left() . 's.' );
160
  }
161
  switch ( $slug ) {
162
 
255
  }
256
 
257
  if ( $lastid != '0' ) {
258
+ if ( wppa_is_cron() ) {
259
+ wppa_log( 'Cron', '{b}' . $slug . '{/b} continued at item # ' . ( $lastid + 1 ) . '. Allowed runtime: ' . wppa_time_left() . 's.' );
260
  }
261
  }
262
 
wppa-session.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all session routines
6
- * Version 8.2.05.001
7
  *
8
  * Firefox modifies data in the superglobal $_SESSION.
9
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
@@ -114,8 +114,8 @@ global $wppa_session;
114
 
115
  // Get info for root and sub search
116
  if ( wppa_get( 'search-submit' ) ) {
117
- $wppa_session['rootbox'] = wppa_get( 'rootsearch' ) || wppa_get( 'rootsearch' );
118
- $wppa_session['subbox'] = wppa_get( 'subsearch' ) || wppa_get( 'subsearch' );
119
  if ( $wppa_session['subbox'] ) {
120
  if ( isset ( $wppa_session['use_searchstring'] ) ) {
121
  $t = explode( ',', $wppa_session['use_searchstring'] );
@@ -160,6 +160,8 @@ global $wppa_session;
160
  'wfcart' => null,
161
  'is_wppa_tree' => false,
162
  'rem_url' => array(),
 
 
163
  );
164
 
165
  $wppa_session = wp_parse_args( $wppa_session, $defaults );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all session routines
6
+ * Version 8.2.06.005
7
  *
8
  * Firefox modifies data in the superglobal $_SESSION.
9
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
114
 
115
  // Get info for root and sub search
116
  if ( wppa_get( 'search-submit' ) ) {
117
+ $wppa_session['rootbox'] = wppa_get( 'rootsearch' );
118
+ $wppa_session['subbox'] = wppa_get( 'subsearch' );
119
  if ( $wppa_session['subbox'] ) {
120
  if ( isset ( $wppa_session['use_searchstring'] ) ) {
121
  $t = explode( ',', $wppa_session['use_searchstring'] );
160
  'wfcart' => null,
161
  'is_wppa_tree' => false,
162
  'rem_url' => array(),
163
+ 'search_albums' => '',
164
+ 'search_photos' => '',
165
  );
166
 
167
  $wppa_session = wp_parse_args( $wppa_session, $defaults );
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.06.003
7
  *
8
  */
9
 
@@ -123,32 +123,7 @@ function wppa_get_thumb_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
123
  if ( wppa_get_option( 'wppa_file_system' ) == 'tree' ) $system = 'tree'; // Has been converted, ignore argument
124
 
125
  if ( $system == 'tree' ) {
126
- $result = WPPA_UPLOAD_PATH.'/thumbs/'.wppa_expand_id($thumb['id'], true).'.'.$thumb['ext'];
127
- }
128
- else {
129
- $result = WPPA_UPLOAD_PATH.'/thumbs/'.$thumb['id'].'.'.$thumb['ext'];
130
- }
131
-
132
- if ( $fix_poster_ext ) {
133
- $result = wppa_fix_poster_ext( $result, $thumb['id'] );
134
- }
135
-
136
- return $result;
137
- }
138
-
139
- // get path of thumb but do not create path
140
- function wppa_get_thumb_path_no_create( $id, $fix_poster_ext = true, $system = 'flat' ) {
141
-
142
- $thumb = wppa_cache_photo( $id );
143
- if ( ! $thumb ) {
144
- return false;
145
- }
146
-
147
- if ( wppa_get_option( 'wppa_file_system' ) == 'flat' ) $system = 'flat'; // Has been converted, ignore argument
148
- if ( wppa_get_option( 'wppa_file_system' ) == 'tree' ) $system = 'tree'; // Has been converted, ignore argument
149
-
150
- if ( $system == 'tree' ) {
151
- $result = WPPA_UPLOAD_PATH.'/thumbs/'.wppa_expand_id($thumb['id'], false).'.'.$thumb['ext'];
152
  }
153
  else {
154
  $result = WPPA_UPLOAD_PATH.'/thumbs/'.$thumb['id'].'.'.$thumb['ext'];
@@ -284,7 +259,7 @@ function wppa_get_photo_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
284
  if ( wppa_get_option( 'wppa_file_system' ) == 'tree' ) $system = 'tree'; // Have been converted, ignore argument
285
 
286
  if ( $system == 'tree' ) {
287
- $result = WPPA_UPLOAD_PATH . '/' . wppa_expand_id( $thumb['id'], true ) . '.' . $thumb['ext'];
288
  }
289
  else {
290
  $result = WPPA_UPLOAD_PATH . '/' . $thumb['id'] . '.' . $thumb['ext'];
@@ -296,7 +271,7 @@ function wppa_get_photo_path( $id, $fix_poster_ext = true, $system = 'flat' ) {
296
  }
297
 
298
  // Expand id to subdir chain for new file structure
299
- function wppa_expand_id( $xid, $makepath = false ) {
300
 
301
  $result = '';
302
  $id = $xid;
@@ -305,9 +280,11 @@ function wppa_expand_id( $xid, $makepath = false ) {
305
  $result .= substr( $id, '0', '2' ) . '/';
306
  $id = substr( $id, '2' );
307
  $len = strlen( $id );
308
- if ( $makepath ) {
309
  $path = WPPA_UPLOAD_PATH . '/' . $result;
310
  if ( ! wppa_is_dir( $path ) ) wppa_mktree( $path );
 
 
311
  $path = WPPA_UPLOAD_PATH . '/thumbs/' . $result;
312
  if ( ! wppa_is_dir( $path ) ) wppa_mktree( $path );
313
  }
@@ -1340,7 +1317,16 @@ global $wpdb;
1340
  // Delete thumbnail immediate
1341
  function wppa_delete_thumb( $id ) {
1342
 
1343
- $path = wppa_get_thumb_path_no_create( $id );
 
 
 
 
 
 
 
 
 
1344
 
1345
  if ( wppa_is_file( $path ) ) {
1346
  wppa_unlink( $path );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 8.2.06.005
7
  *
8
  */
9
 
123
  if ( wppa_get_option( 'wppa_file_system' ) == 'tree' ) $system = 'tree'; // Has been converted, ignore argument
124
 
125
  if ( $system == 'tree' ) {
126
+ $result = WPPA_UPLOAD_PATH.'/thumbs/'.wppa_expand_id($thumb['id'], true, false).'.'.$thumb['ext'];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
127
  }
128
  else {
129
  $result = WPPA_UPLOAD_PATH.'/thumbs/'.$thumb['id'].'.'.$thumb['ext'];
259
  if ( wppa_get_option( 'wppa_file_system' ) == 'tree' ) $system = 'tree'; // Have been converted, ignore argument
260
 
261
  if ( $system == 'tree' ) {
262
+ $result = WPPA_UPLOAD_PATH . '/' . wppa_expand_id( $thumb['id'], false, true ) . '.' . $thumb['ext'];
263
  }
264
  else {
265
  $result = WPPA_UPLOAD_PATH . '/' . $thumb['id'] . '.' . $thumb['ext'];
271
  }
272
 
273
  // Expand id to subdir chain for new file structure
274
+ function wppa_expand_id( $xid, $makepaththumb = false, $makepathphoto = false ) {
275
 
276
  $result = '';
277
  $id = $xid;
280
  $result .= substr( $id, '0', '2' ) . '/';
281
  $id = substr( $id, '2' );
282
  $len = strlen( $id );
283
+ if ( $makepathphoto ) {
284
  $path = WPPA_UPLOAD_PATH . '/' . $result;
285
  if ( ! wppa_is_dir( $path ) ) wppa_mktree( $path );
286
+ }
287
+ if ( $makepaththumb ) {
288
  $path = WPPA_UPLOAD_PATH . '/thumbs/' . $result;
289
  if ( ! wppa_is_dir( $path ) ) wppa_mktree( $path );
290
  }
1317
  // Delete thumbnail immediate
1318
  function wppa_delete_thumb( $id ) {
1319
 
1320
+ // $path = wppa_get_thumb_path( $id );
1321
+ if ( wppa_get_option( 'wppa_file_system' ) == 'flat' ) $system = 'flat'; // Has been converted, ignore argument
1322
+ if ( wppa_get_option( 'wppa_file_system' ) == 'tree' ) $system = 'tree'; // Has been converted, ignore argument
1323
+
1324
+ if ( $system == 'tree' ) {
1325
+ $path = WPPA_UPLOAD_PATH.'/thumbs/'.wppa_expand_id( $thumb['id'] ).'.'.$thumb['ext'];
1326
+ }
1327
+ else {
1328
+ $path = WPPA_UPLOAD_PATH.'/thumbs/'.$thumb['id'].'.'.$thumb['ext'];
1329
+ }
1330
 
1331
  if ( wppa_is_file( $path ) ) {
1332
  wppa_unlink( $path );
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.008
9
  *
10
  */
11
 
@@ -361,6 +361,7 @@ function wppa_rmdir( $dir, $when_empty = false ) {
361
  $files = glob( $dir . '/*' );
362
  if ( empty( $files ) ) {
363
  rmdir( $dir );
 
364
  }
365
  if ( wppa_is_dir( $dir ) ) {
366
  wppa_log( 'Err', 'Could not remove dir ' . wppa_shortpath( $dir ) );
5
  * Contains wrappers for standard php functions
6
  * For security and bug reasons
7
  *
8
+ * Version 8.2.06.005
9
  *
10
  */
11
 
361
  $files = glob( $dir . '/*' );
362
  if ( empty( $files ) ) {
363
  rmdir( $dir );
364
+ clearstatcache();
365
  }
366
  if ( wppa_is_dir( $dir ) ) {
367
  wppa_log( 'Err', 'Could not remove dir ' . wppa_shortpath( $dir ) );
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.06.004
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
@@ -23,7 +23,7 @@ global $wpdb;
23
  global $wp_version;
24
 
25
  /* WPPA Version */
26
- global $wppa_version; $wppa_version = '8.2.06.004'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */
@@ -35,17 +35,15 @@ 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
- $met = 60;
41
  }
42
-
43
- if ( $met <= 0 ) {
44
- $met = 30;
45
  }
46
-
47
- // $met = 30; // debug
48
- $wppa_endtime = time() + $met;
49
  }
50
 
51
  /* Set defaults */
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.06.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
  global $wp_version;
24
 
25
  /* WPPA Version */
26
+ global $wppa_version; $wppa_version = '8.2.06.005'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */
35
  global $wppa_endtime;
36
 
37
  $met = intval( ini_get( 'max_execution_time' ) );
38
+
39
+ if ( wppa_is_cron() ) {
40
+ $the_met = max ( min( $met, 120 ), 30 );
41
  }
42
+ else {
43
+ $the_met = max ( min( $met, 180 ), 30 );
 
44
  }
45
+
46
+ $wppa_endtime = time() + $the_met;
 
47
  }
48
 
49
  /* Set defaults */