WP Photo Album Plus - Version 8.2.06.002

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

Code changes from version 8.2.06.001 to 8.2.06.002

Files changed (4) hide show
  1. wppa-export.php +13 -1
  2. wppa-import.php +5 -37
  3. wppa-utils.php +64 -3
  4. wppa.php +2 -2
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.001
7
  *
8
  */
9
 
@@ -11,6 +11,18 @@ function _wppa_page_export() {
11
  global $wpdb;
12
 
13
  // Export Photos admin page
 
 
 
 
 
 
 
 
 
 
 
 
14
 
15
  // Do the export if requested
16
  if ( wppa_get( 'export-submit' ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the export functions
6
+ * Version 8.2.06.002
7
  *
8
  */
9
 
11
  global $wpdb;
12
 
13
  // Export Photos admin page
14
+
15
+ // See if our depot dir van be or has been created
16
+ if ( ! wppa_is_dir( WPPA_DEPOT_PATH ) ) {
17
+ wppa_mktree( WPPA_DEPOT_PATH );
18
+ if ( ! wppa_is_dir( WPPA_DEPOT_PATH ) ) {
19
+
20
+ wppa_error_message( sprintf(
21
+ __( 'Your depot directory <b>%s</b> could not be created.<br>Please create it yourself using a ftp program and make sure the filesystem rights are set to 0755',
22
+ 'wp-photo-album-plus' ), WPPA_DEPOT_PATH ) );
23
+ wppa_exit();
24
+ }
25
+ }
26
 
27
  // Do the export if requested
28
  if ( wppa_get( 'export-submit' ) ) {
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.008
7
  *
8
  */
9
 
@@ -2182,7 +2182,11 @@ global $wppa_session;
2182
  $setting = wppa_get_option( 'wppa_import_source_url_'.$user, 'http://' );
2183
  $setting_x = wppa_expand_tree_path( $setting );
2184
  if ( ( ! $wppa_session['is_wppa_tree'] && wppa_is_url_a_photo( $setting, false ) ) || wppa_is_url_a_photo( $setting_x, false ) ) {
 
 
 
2185
  wppa_update_option( 'wppa_import_source_url_' . wppa_get_user(), wppa_compress_tree_path( $unsanitized_path_name ) );
 
2186
  }
2187
 
2188
  $path = WPPA_DEPOT_PATH . '/' . basename( wppa_compress_tree_path( $unsanitized_path_name ) );
@@ -3237,42 +3241,6 @@ global $wppa_session;
3237
  return true;
3238
  }
3239
 
3240
- function wppa_is_wppa_tree( $file ) {
3241
-
3242
- $temp = explode( '/uploads/wppa/', $file );
3243
- if ( count( $temp ) === 2 ) {
3244
- $temp[1] = wppa_expand_id( wppa_strip_ext( $temp[1] ) ) . '.' . wppa_get_ext( $temp[1] );
3245
- $newf = implode( '/wppa/', $temp );
3246
- wppa( 'is_wppa_tree', ( $newf != $file ) );
3247
- }
3248
- else {
3249
- wppa( 'is_wppa_tree', false );
3250
- }
3251
- return wppa( 'is_wppa_tree' );
3252
- }
3253
-
3254
- function wppa_compress_tree_path( $path ) {
3255
-
3256
- $result = $path;
3257
- $temp = explode( '/wppa/', $path );
3258
- if ( count( $temp ) == '2' ) {
3259
- $temp[1] = str_replace( '/', '', $temp[1] );
3260
- $result = implode( '/wppa/', $temp );
3261
- }
3262
- return $result;
3263
- }
3264
-
3265
- function wppa_expand_tree_path( $path ) {
3266
-
3267
- $result = $path;
3268
- $temp = explode( '/wppa/', $path );
3269
- if ( count( $temp ) == '2' ) {
3270
- $temp[1] = wppa_expand_id( wppa_strip_ext( $temp[1] ) ) . '.' . wppa_get_ext( $temp[1] );
3271
- $result = implode( '/wppa/', $temp );
3272
- }
3273
- return $result;
3274
- }
3275
-
3276
  function wppa_abs_walktree( $root, $source ) {
3277
  static $void_dirs;
3278
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the import pages and functions
6
+ * Version 8.2.06.002
7
  *
8
  */
9
 
2182
  $setting = wppa_get_option( 'wppa_import_source_url_'.$user, 'http://' );
2183
  $setting_x = wppa_expand_tree_path( $setting );
2184
  if ( ( ! $wppa_session['is_wppa_tree'] && wppa_is_url_a_photo( $setting, false ) ) || wppa_is_url_a_photo( $setting_x, false ) ) {
2185
+ if ( strcmp( $setting, wppa_compress_tree_path( $unsanitized_path_name ) ) > 0 ) {
2186
+ wppa_log('err', 'Attempt to update to a lower value', true );
2187
+ }
2188
  wppa_update_option( 'wppa_import_source_url_' . wppa_get_user(), wppa_compress_tree_path( $unsanitized_path_name ) );
2189
+ wppa_log('obs', 'path updated to '.wppa_compress_tree_path( $unsanitized_path_name ));
2190
  }
2191
 
2192
  $path = WPPA_DEPOT_PATH . '/' . basename( wppa_compress_tree_path( $unsanitized_path_name ) );
3241
  return true;
3242
  }
3243
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3244
  function wppa_abs_walktree( $root, $source ) {
3245
  static $void_dirs;
3246
 
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.001
7
  *
8
  */
9
 
@@ -834,6 +834,7 @@ global $all_wppa_options;
834
 
835
  // Update the option
836
  update_option( $option, $value );
 
837
 
838
  // Update the local cache
839
  $wppa_opt[$option] = $value;
@@ -1283,8 +1284,9 @@ global $wpdb;
1283
  if ( is_file( $file ) ) wppa_unlink( $file );
1284
 
1285
  // Delete thumbnail image
1286
- $file = wppa_get_thumb_path( $photo );
1287
- if ( is_file( $file ) ) wppa_unlink( $file );
 
1288
 
1289
  // Delete index
1290
  wppa_index_remove('photo', $photo);
@@ -1310,6 +1312,65 @@ global $wpdb;
1310
  }
1311
  }
1312
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1313
  // Undelete photo
1314
  function wppa_undelete_photo( $photo, $echo ) {
1315
  global $wpdb;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 8.2.06.002
7
  *
8
  */
9
 
834
 
835
  // Update the option
836
  update_option( $option, $value );
837
+ if ( $option == 'wppa_import_source_url_admin' ) wppa_log( 'obs', 'Update_option('.$option.', '.$value.')');
838
 
839
  // Update the local cache
840
  $wppa_opt[$option] = $value;
1284
  if ( is_file( $file ) ) wppa_unlink( $file );
1285
 
1286
  // Delete thumbnail image
1287
+ wppa_delete_thumb( $photo );
1288
+ // $file = wppa_get_thumb_path( $photo );
1289
+ // if ( is_file( $file ) ) wppa_unlink( $file );
1290
 
1291
  // Delete index
1292
  wppa_index_remove('photo', $photo);
1312
  }
1313
  }
1314
 
1315
+ // Delete thumbnail immediate
1316
+ function wppa_delete_thumb( $id ) {
1317
+
1318
+ $path = wppa_get_thumb_path( $id );
1319
+
1320
+ if ( wppa_is_file( $path ) ) {
1321
+ wppa_unlink( $path );
1322
+ }
1323
+
1324
+ if ( wppa_is_wppa_tree( $path ) ) {
1325
+ // wppa_try_del_tree( $path );
1326
+ }
1327
+ }
1328
+ function wppa_try_del_tree( $path ) {
1329
+ $dir = dirname( $path );
1330
+ $files = wppa_glob( $dir );
1331
+ if ( count( $files ) == 2 ) {
1332
+ wppa_log( 'obs', 'Should delete '.$dir );
1333
+ // rmdir( $dir );
1334
+ wppa_try_del_tree( $dir );
1335
+ }
1336
+ }
1337
+
1338
+ function wppa_is_wppa_tree( $file ) {
1339
+
1340
+ $temp = explode( '/uploads/wppa/', $file );
1341
+ if ( count( $temp ) === 2 ) {
1342
+ $temp[1] = wppa_expand_id( wppa_strip_ext( $temp[1] ) ) . '.' . wppa_get_ext( $temp[1] );
1343
+ $newf = implode( '/wppa/', $temp );
1344
+ wppa( 'is_wppa_tree', ( $newf != $file ) );
1345
+ }
1346
+ else {
1347
+ wppa( 'is_wppa_tree', false );
1348
+ }
1349
+ return wppa( 'is_wppa_tree' );
1350
+ }
1351
+
1352
+ function wppa_compress_tree_path( $path ) {
1353
+
1354
+ $result = $path;
1355
+ $temp = explode( '/wppa/', $path );
1356
+ if ( count( $temp ) == '2' ) {
1357
+ $temp[1] = str_replace( '/', '', $temp[1] );
1358
+ $result = implode( '/wppa/', $temp );
1359
+ }
1360
+ return $result;
1361
+ }
1362
+
1363
+ function wppa_expand_tree_path( $path ) {
1364
+
1365
+ $result = $path;
1366
+ $temp = explode( '/wppa/', $path );
1367
+ if ( count( $temp ) == '2' ) {
1368
+ $temp[1] = wppa_expand_id( wppa_strip_ext( $temp[1] ) ) . '.' . wppa_get_ext( $temp[1] );
1369
+ $result = implode( '/wppa/', $temp );
1370
+ }
1371
+ return $result;
1372
+ }
1373
+
1374
  // Undelete photo
1375
  function wppa_undelete_photo( $photo, $echo ) {
1376
  global $wpdb;
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.001
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.001'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */
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.002
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
23
  global $wp_version;
24
 
25
  /* WPPA Version */
26
+ global $wppa_version; $wppa_version = '8.2.06.002'; // WPPA software version
27
  global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
28
 
29
  /* Init page js data */