WP Photo Album Plus - Version 7.7.04.006

Version Description

= 7.7.04 =

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

Code changes from version 7.7.04.005 to 7.7.04.006

Files changed (4) hide show
  1. wppa-mailing.php +26 -34
  2. wppa-setup.php +4 -4
  3. wppa-utils.php +2 -2
  4. wppa.php +2 -2
wppa-mailing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains mailing functions
6
  *
7
- * Version 7.7.04.005
8
  *
9
  */
10
 
@@ -880,7 +880,14 @@ function wppa_unsubscribe_link( $user_id, $listtype ) {
880
 
881
  // Send a mail
882
  function wppa_send_mail( $args ) {
 
883
 
 
 
 
 
 
 
884
  $defaults = array( 'to' => '',
885
  'subj' => '',
886
  'cont' => '',
@@ -991,11 +998,8 @@ function wppa_send_mail( $args ) {
991
  $message = $message_part_1 . $message_part_2 . $message_part_3;
992
 
993
  // If this mail has already been sent, skip and report
994
- $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
995
- $cache = get_option( 'wppa_sent_mails', '' );
996
- if ( strpos( $cache, $hash ) !== false ) {
997
-
998
- // if ( wppa_has_mail_been_sent( $to, $subject, $message, $headers ) ) {
999
  wppa_log( 'Eml', 'Hash: ' . $hash . ' Sending duplicate mail skipped to: ' . $to . ' (' . $id . ') subject: ' . $subject );
1000
  return;
1001
  }
@@ -1049,43 +1053,31 @@ function wppa_get_mail_hash( $to = '', $subject = '', $message = '', $headers =
1049
  return md5( ( is_array( $to ) ? implode( '|', $to ) : $to ) . $subject . $mes );
1050
  }
1051
 
1052
- // Has mail been sent already?
1053
- /*
1054
- function wppa_has_mail_been_sent( $to = '', $subject = '', $message = '', $headers = '' ) {
1055
-
1056
- // Compute current hash
1057
- $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
1058
-
1059
- // Get the saved sent mail hashes
1060
- $sent_mails = get_option( 'wppa_sent_mails', '' );
1061
-
1062
- $bret = strpos( $sent_mails, $hash ) !== false;
1063
- if ( $bret ) {
1064
- wppa_log('eml', 'Mail to '.$to.', subject '.$subject.' has already been sent');
1065
- }
1066
- return $bret;
1067
- }
1068
- */
1069
-
1070
  // Register mail has been sent
1071
  function wppa_process_success_mail( $hash ) {
 
1072
 
1073
  // Get the saved sent mail hashes
1074
- $sent_mails = get_option( 'wppa_sent_mails', '' );
 
 
1075
 
1076
  // Trim optionally
1077
- if ( strlen( $sent_mails ) > 3300 ) {
1078
- $sent_mails = substr( $sent_mails, 66 );
1079
  }
1080
 
1081
- // Ad our hash optionally
1082
- if ( strpos( $sent_mails, $hash ) === false ) {
1083
- $sent_mails .= ',' . $hash;
1084
- }
1085
 
1086
- // Save new saved hashes
1087
- update_option( 'wppa_sent_mails', ltrim( $sent_mails, ',' ) );
1088
- wppa_log( 'eml', 'Hash: ' . $hash . ' added to sent mails' );
 
 
 
 
1089
  }
1090
 
1091
  // Save failed mail data to retry later
4
  *
5
  * Contains mailing functions
6
  *
7
+ * Version 7.7.04.006
8
  *
9
  */
10
 
880
 
881
  // Send a mail
882
  function wppa_send_mail( $args ) {
883
+ global $wppa_sent_mails_hashes;
884
 
885
+ // Get the saved sent mail hashes
886
+ if ( ! $wppa_sent_mails_hashes ) {
887
+ $wppa_sent_mails_hashes = get_option( 'wppa_sent_mails', '' );
888
+ }
889
+
890
+ // Enhance $args
891
  $defaults = array( 'to' => '',
892
  'subj' => '',
893
  'cont' => '',
998
  $message = $message_part_1 . $message_part_2 . $message_part_3;
999
 
1000
  // If this mail has already been sent, skip and report
1001
+ $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
1002
+ if ( strpos( $wppa_sent_mails_hashes, $hash ) !== false ) {
 
 
 
1003
  wppa_log( 'Eml', 'Hash: ' . $hash . ' Sending duplicate mail skipped to: ' . $to . ' (' . $id . ') subject: ' . $subject );
1004
  return;
1005
  }
1053
  return md5( ( is_array( $to ) ? implode( '|', $to ) : $to ) . $subject . $mes );
1054
  }
1055
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1056
  // Register mail has been sent
1057
  function wppa_process_success_mail( $hash ) {
1058
+ global $wppa_sent_mails_hashes;
1059
 
1060
  // Get the saved sent mail hashes
1061
+ if ( ! $wppa_sent_mails_hashes ) {
1062
+ $wppa_sent_mails_hashes = get_option( 'wppa_sent_mails', '' );
1063
+ }
1064
 
1065
  // Trim optionally
1066
+ if ( strlen( $wppa_sent_mails_hashes ) > 3300 ) {
1067
+ $wppa_sent_mails_hashes = substr( $wppa_sent_mails_hashes, 66 );
1068
  }
1069
 
1070
+ // Add our hash optionally
1071
+ if ( strpos( $wppa_sent_mails_hashes, $hash ) === false ) {
1072
+ $wppa_sent_mails_hashes .= ',' . $hash;
 
1073
 
1074
+ // Save new saved hashes
1075
+ update_option( 'wppa_sent_mails', ltrim( $wppa_sent_mails_hashes, ',' ) );
1076
+ wppa_log( 'eml', 'Hash: ' . $hash . ' added to sent mails' );
1077
+ }
1078
+ else {
1079
+ wppa_log( 'eml', 'Hash: ' . $hash . ' NOT added to sent mails' );
1080
+ }
1081
  }
1082
 
1083
  // Save failed mail data to retry later
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 7.7.04.002
7
  *
8
  */
9
 
@@ -655,12 +655,12 @@ global $wppa_error;
655
  }
656
 
657
  if ( $old_rev <= '7704999' ) {
658
- delete_option( 'wppa_sent_mails' );
 
 
659
  }
660
  }
661
 
662
- // wppa_set_defaults();
663
-
664
  // Check required directories
665
  if ( ! wppa_check_dirs() ) $wppa_error = true;
666
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 7.7.04.006
7
  *
8
  */
9
 
655
  }
656
 
657
  if ( $old_rev <= '7704999' ) {
658
+ if ( strlen( get_option( 'wppa_sent_mails', '' ) ) > 3300 ) {
659
+ delete_option( 'wppa_sent_mails' );
660
+ }
661
  }
662
  }
663
 
 
 
664
  // Check required directories
665
  if ( ! wppa_check_dirs() ) $wppa_error = true;
666
 
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.7.04.002
7
  *
8
  */
9
 
@@ -1746,7 +1746,7 @@ static $repeat_count;
1746
  // Write log message
1747
  $msg = strip_tags( $msg );
1748
  $msg = wppa_nl2sp( $msg );
1749
- array_push( $contents, '{b}'.$type.'{/b}: on:'.wppa_local_date( 'd.m.Y H:i:s', time()).': '.wppa_get_user().': '.$msg. "\n" );
1750
 
1751
  // Log stacktrace 5 levels
1752
  if ( $trace ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.7.04.006
7
  *
8
  */
9
 
1746
  // Write log message
1747
  $msg = strip_tags( $msg );
1748
  $msg = wppa_nl2sp( $msg );
1749
+ array_push( $contents, '{b}'.$type.'{/b}: on:'.wppa_local_date( 'd.m.Y H:i:s', time()).': '.wppa_get_user().' ('.getmypid().'): '.$msg. "\n" );
1750
 
1751
  // Log stacktrace 5 levels
1752
  if ( $trace ) {
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.04.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/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '7.7.04.005'; // 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.04.006
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.04.006'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30