WP Photo Album Plus - Version 7.7.05.003

Version Description

= 7.7.05 =

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

Release Info

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

Code changes from version 7.7.05.002 to 7.7.05.003

changelog.txt CHANGED
@@ -5,7 +5,8 @@ WP Photo Album Plus Changelog
5
  * The 'You can see the photo here' link on moderate comment request mailings did not work. Fixed.
6
  * The logfile admin page will now be updated every 5 seconds.
7
  * On the Album Admin -> Edit album information page you can now schedule a time to delete an album.
8
- * When a deleted photo is being undeleted and the original album has been removed, it will be re-created with default settings and with paren set to ---separate---
 
9
 
10
  = 7.7.04 =
11
 
5
  * The 'You can see the photo here' link on moderate comment request mailings did not work. Fixed.
6
  * The logfile admin page will now be updated every 5 seconds.
7
  * On the Album Admin -> Edit album information page you can now schedule a time to delete an album.
8
+ When this time arrives, the album will be removed and the photos will be trashed and permanently removed in a background process after at least one hour.
9
+ * When a deleted photo is being undeleted and the original album has been removed, the album will be re-created with default settings and with parent set to ---separate---
10
 
11
  = 7.7.04 =
12
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, f
5
  Requires at least: 3.9
6
  Tested up to: 5.7
7
  Requires PHP: 5.5
8
- Stable tag: 7.7.04.009
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
5
  Requires at least: 3.9
6
  Tested up to: 5.7
7
  Requires PHP: 5.5
8
+ Stable tag: 7.7.05.003
9
  License: GPLv2 or later
10
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
 
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.7.05.002
6
  *
7
  */
8
 
@@ -2087,28 +2087,47 @@ global $wpdb;
2087
  if ( $last_check < ( time() - 300 ) ) { // Longer than 5 mins ago
2088
 
2089
  // Publish scheduled photos
2090
- $to_publish = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status = 'scheduled' AND scheduledtm < %s", wppa_get_default_scheduledtm() ), ARRAY_A );
 
 
 
2091
  if ( $to_publish ) foreach( $to_publish as $photo ) {
2092
  wppa_update_photo( array( 'id' => $photo['id'], 'scheduledtm' => '', 'status' => 'publish', 'timestamp' => time() ) );
2093
  wppa_update_album( array( 'id' => $photo['album'], 'modified' => time() ) ); // For New indicator on album
2094
  wppa_invalidate_treecounts( $photo['album'] );
2095
  }
2096
 
2097
- // Publish scheduled albums ( for future use, currently not implemented )
2098
- $to_publish = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE scheduledtm <> '' AND scheduledtm < %s", wppa_get_default_scheduledtm() ), ARRAY_A );
2099
- if ( $to_publish ) foreach( $to_publish as $album ) {
2100
- wppa_update_album( array( 'id' => $album['id'], 'scheduledtm' => '' ) );
2101
- wppa_invalidate_treecounts( $album['id'] );
 
 
 
2102
  }
2103
 
 
 
 
2104
  // Delete photos scheduled for deletion
2105
- $to_delete = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE scheduledel <> '' AND scheduledel < %s", wppa_get_default_scheduledtm() ), ARRAY_A );
2106
- if ( $to_delete ) foreach( $to_delete as $photo ) {
2107
- wppa_delete_photo( $photo['id'] );
 
 
 
 
 
2108
  }
2109
 
2110
  // Delete albums scheduled for deletion
2111
- $albums_to_delete = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums WHERE scheduledel <> '' AND scheduledel < %s", wppa_get_default_scheduledtm() ) );
 
 
 
 
 
2112
  if ( $albums_to_delete ) {
2113
  $delalbs = implode( ',', $albums_to_delete );
2114
  $photos_to_delete = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album IN ( $delalbs )" );
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.7.05.003
6
  *
7
  */
8
 
2087
  if ( $last_check < ( time() - 300 ) ) { // Longer than 5 mins ago
2088
 
2089
  // Publish scheduled photos
2090
+ $to_publish = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
2091
+ WHERE status = 'scheduled'
2092
+ AND scheduledtm < %s",
2093
+ wppa_get_default_scheduledtm() ), ARRAY_A );
2094
  if ( $to_publish ) foreach( $to_publish as $photo ) {
2095
  wppa_update_photo( array( 'id' => $photo['id'], 'scheduledtm' => '', 'status' => 'publish', 'timestamp' => time() ) );
2096
  wppa_update_album( array( 'id' => $photo['album'], 'modified' => time() ) ); // For New indicator on album
2097
  wppa_invalidate_treecounts( $photo['album'] );
2098
  }
2099
 
2100
+ // Remove scheduledtm from albums when it is in the past, so new photos do not get this anymore
2101
+ $to_update = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums
2102
+ WHERE scheduledtm <> ''
2103
+ AND scheduledtm < %s",
2104
+ wppa_get_default_scheduledtm() ) );
2105
+ if ( $to_update ) foreach( $to_update as $id ) {
2106
+ wppa_update_album( array( 'id' => $id, 'scheduledtm' => '' ) );
2107
+ wppa_invalidate_treecounts( $id );
2108
  }
2109
 
2110
+ // Delete only when the time modified is more than ten minutes ago, to prevent accidental removal during configuration
2111
+ $maxtime = time() - 600;
2112
+
2113
  // Delete photos scheduled for deletion
2114
+ $to_delete = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos
2115
+ WHERE scheduledel <> ''
2116
+ AND scheduledel < %s
2117
+ AND modified < %s",
2118
+ wppa_get_default_scheduledtm(),
2119
+ $maxtime ) );
2120
+ if ( $to_delete ) foreach( $to_delete as $id ) {
2121
+ wppa_delete_photo( $id );
2122
  }
2123
 
2124
  // Delete albums scheduled for deletion
2125
+ $albums_to_delete = $wpdb->get_col( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_albums
2126
+ WHERE scheduledel <> ''
2127
+ AND scheduledel < %s
2128
+ AND modified < %s",
2129
+ wppa_get_default_scheduledtm(),
2130
+ $maxtime ) );
2131
  if ( $albums_to_delete ) {
2132
  $delalbs = implode( ',', $albums_to_delete );
2133
  $photos_to_delete = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album IN ( $delalbs )" );
wppa-slideshow.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the slideshow high level functions
6
- * Version 7.7.02.006
7
  *
8
  */
9
 
@@ -190,7 +190,7 @@ global $previous_page_last_id;
190
  }
191
 
192
  $previous_page_last_id = '0';
193
- if ( $skips ) {
194
  $previous_page_last_id = $thumbs_ids[$skips - 1];
195
  }
196
  else {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the slideshow high level functions
6
+ * Version 7.7.05.003
7
  *
8
  */
9
 
190
  }
191
 
192
  $previous_page_last_id = '0';
193
+ if ( $skips && isset( $thumbs_ids[$skips - 1] ) ) {
194
  $previous_page_last_id = $thumbs_ids[$skips - 1];
195
  }
196
  else {
wppa-wpdb-insert.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
- * Version 7.7.05.002
7
  *
8
  */
9
 
@@ -287,7 +287,7 @@ global $wpdb;
287
  'linktarget' => '_self',
288
  'owner' => ( wppa_opt( 'newphoto_owner' ) ? wppa_opt( 'newphoto_owner' ) : wppa_get_user() ),
289
  'timestamp' => time(),
290
- 'status' => wppa_opt( 'wppa_status_new' ),
291
  'rating_count' => '0',
292
  'tags' => '',
293
  'alt' => '',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
+ * Version 7.7.05.003
7
  *
8
  */
9
 
287
  'linktarget' => '_self',
288
  'owner' => ( wppa_opt( 'newphoto_owner' ) ? wppa_opt( 'newphoto_owner' ) : wppa_get_user() ),
289
  'timestamp' => time(),
290
+ 'status' => wppa_opt( 'status_new' ),
291
  'rating_count' => '0',
292
  'tags' => '',
293
  'alt' => '',
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.7.05.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/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '7.7.05.002'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30
 
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.7.05.003
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/
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
+ $wppa_api_version = '7.7.05.003'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30