WP Photo Album Plus - Version 7.7.04.005

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

Code changes from version 7.7.04.004 to 7.7.04.005

wppa-album-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
- * Version 7.7.04.001
7
  *
8
  */
9
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 7.7.04.005
7
  *
8
  */
9
 
wppa-mailing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains mailing functions
6
  *
7
- * Version 7.7.04.004
8
  *
9
  */
10
 
@@ -141,7 +141,7 @@ global $wpdb;
141
  switch( $type ) {
142
 
143
  case 'newalbumnotify':
144
- {
145
  // If album removed, quit
146
  $album = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id = %d", $alb ), ARRAY_A );
147
  if ( ! $album ) {
@@ -208,11 +208,11 @@ global $wpdb;
208
  }
209
  }
210
  }
211
- }
212
  break;
213
 
214
  case 'feuploadnotify':
215
- {
216
  // If moderation required, do the moderatephoto mailing
217
  if ( wppa_get_photo_item( $pho, 'status' ) == 'pending' ) {
218
  wppa_schedule_mailinglist( 'moderatephoto', $alb, $pho, $com, $url );
@@ -297,11 +297,11 @@ global $wpdb;
297
  }
298
  wppa_log('dbg', 'deleting option:' .'last_feuploadnotify_scheduled-' . $owner . '-' . $alb);
299
  delete_option( 'last_feuploadnotify_scheduled-' . $owner . '-' . $alb );
300
- }
301
  break;
302
 
303
  case 'commentnotify':
304
- {
305
  // Get the comment
306
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
307
 
@@ -418,11 +418,11 @@ global $wpdb;
418
 
419
  // Now do the 'commentprevious' mailing
420
  wppa_schedule_mailinglist( 'commentprevious', 0, 0, $com );
421
- }
422
  break;
423
 
424
  case 'photoapproved':
425
- {
426
  // To who?
427
  $user = get_user_by( 'login', wppa_get_photo_item( $pho, 'owner' ) );
428
  if ( ! $user ) {
@@ -464,12 +464,12 @@ global $wpdb;
464
 
465
  // Now the photo is approved, we can mail 'feuploadnotify'
466
  wppa_schedule_mailinglist( 'feuploadnotify', 0, $pho );
467
- }
468
  break;
469
 
470
  // A comment on my photo is approved or my comment is approved
471
  case 'commentapproved':
472
- {
473
  // Get the comment
474
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
475
 
@@ -555,11 +555,11 @@ global $wpdb;
555
  // Now the comment is approved, we can mail 'commentnotify'
556
  wppa_schedule_mailinglist( 'commentnotify', 0, 0, $com );
557
 
558
- }
559
  break;
560
 
561
  case 'commentprevious':
562
- {
563
  // Get the comment
564
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
565
 
@@ -630,11 +630,11 @@ global $wpdb;
630
  }
631
  }
632
  }
633
- }
634
  break;
635
 
636
  case 'moderatephoto':
637
- {
638
  // The subject
639
  $subj = sprintf( __( 'New photo moderate request: %s' , 'wp-photo-album-plus'), wppa_get_photo_item( $pho, 'name' ) );
640
 
@@ -696,11 +696,11 @@ global $wpdb;
696
  wppa_unsubscribe_all( $usr );
697
  }
698
  }
699
- }
700
  break;
701
 
702
  case 'moderatecomment':
703
- {
704
  // The comment
705
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
706
 
@@ -773,7 +773,7 @@ global $wpdb;
773
  wppa_unsubscribe_all( $usr );
774
  }
775
  }
776
- }
777
  break;
778
 
779
  default:
@@ -919,22 +919,6 @@ function wppa_send_mail( $args ) {
919
  $message_part_2 = '';
920
  $message_part_3 = '';
921
 
922
- /*
923
- $site = home_url();
924
- $site = str_replace( 'https://www.', '', $site );
925
- $site = str_replace( 'http://www.', '', $site );
926
- $site = str_replace( 'https://', '', $site );
927
- $site = str_replace( 'http://', '', $site );
928
- $spos = strpos( $site, '/' );
929
- if ( $spos > '2' ) {
930
- $site = substr( $site, 0, $spos );
931
- }
932
- /*
933
- $headers = array( 'From: ' . wppa_opt( 'email_from_email' ) . ' <' . wppa_opt( 'email_from_email' ) . '>',
934
- 'Content-Type: text/html; charset=UTF-8',
935
- 'Reply-to: ' . wppa_opt( 'email_from_email' ) . ' <' . wppa_opt( 'email_from_email' ) . '>',
936
- );
937
- */
938
  $headers = array( 'From: ' . wppa_opt( 'email_from_email' ),
939
  'Content-Type: text/html; charset=UTF-8'
940
  );
@@ -1007,8 +991,12 @@ function wppa_send_mail( $args ) {
1007
  $message = $message_part_1 . $message_part_2 . $message_part_3;
1008
 
1009
  // If this mail has already been sent, skip and report
1010
- if ( wppa_has_mail_been_sent( $to, $subject, $message, $headers ) ) {
1011
- wppa_log( 'Eml', 'Sending duplicate mail skipped to: ' . $to . ' (' . $id . ') subject: ' . $subject );
 
 
 
 
1012
  return;
1013
  }
1014
 
@@ -1024,7 +1012,7 @@ function wppa_send_mail( $args ) {
1024
  'Mail sent to: ' . $to . ' (' . $id . ') ' .
1025
  'subject: ' . $subject . ', ' .
1026
  'photo: ' . ( $photo ? ( is_array( $photo ) ? serialize( $photo ) : $photo ) : 'not supplied.' ) );
1027
- wppa_process_success_mail( $to, $subject, $message, $headers );
1028
  return;
1029
  }
1030
 
@@ -1062,6 +1050,7 @@ function wppa_get_mail_hash( $to = '', $subject = '', $message = '', $headers =
1062
  }
1063
 
1064
  // Has mail been sent already?
 
1065
  function wppa_has_mail_been_sent( $to = '', $subject = '', $message = '', $headers = '' ) {
1066
 
1067
  // Compute current hash
@@ -1076,28 +1065,27 @@ function wppa_has_mail_been_sent( $to = '', $subject = '', $message = '', $heade
1076
  }
1077
  return $bret;
1078
  }
 
1079
 
1080
  // Register mail has been sent
1081
- function wppa_process_success_mail( $to = '', $subject = '', $message = '', $headers = '' ) {
1082
-
1083
- // Compute current hash
1084
- $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
1085
 
1086
  // Get the saved sent mail hashes
1087
  $sent_mails = get_option( 'wppa_sent_mails', '' );
1088
 
1089
  // Trim optionally
1090
- if ( strlen( $sent_mails ) > 660 ) {
1091
  $sent_mails = substr( $sent_mails, 66 );
1092
  }
1093
 
1094
  // Ad our hash optionally
1095
- if ( strpos( $sent_mails, $hash ) == false ) {
1096
  $sent_mails .= ',' . $hash;
1097
  }
1098
 
1099
  // Save new saved hashes
1100
  update_option( 'wppa_sent_mails', ltrim( $sent_mails, ',' ) );
 
1101
  }
1102
 
1103
  // Save failed mail data to retry later
4
  *
5
  * Contains mailing functions
6
  *
7
+ * Version 7.7.04.005
8
  *
9
  */
10
 
141
  switch( $type ) {
142
 
143
  case 'newalbumnotify':
144
+
145
  // If album removed, quit
146
  $album = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id = %d", $alb ), ARRAY_A );
147
  if ( ! $album ) {
208
  }
209
  }
210
  }
211
+
212
  break;
213
 
214
  case 'feuploadnotify':
215
+
216
  // If moderation required, do the moderatephoto mailing
217
  if ( wppa_get_photo_item( $pho, 'status' ) == 'pending' ) {
218
  wppa_schedule_mailinglist( 'moderatephoto', $alb, $pho, $com, $url );
297
  }
298
  wppa_log('dbg', 'deleting option:' .'last_feuploadnotify_scheduled-' . $owner . '-' . $alb);
299
  delete_option( 'last_feuploadnotify_scheduled-' . $owner . '-' . $alb );
300
+
301
  break;
302
 
303
  case 'commentnotify':
304
+
305
  // Get the comment
306
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
307
 
418
 
419
  // Now do the 'commentprevious' mailing
420
  wppa_schedule_mailinglist( 'commentprevious', 0, 0, $com );
421
+
422
  break;
423
 
424
  case 'photoapproved':
425
+
426
  // To who?
427
  $user = get_user_by( 'login', wppa_get_photo_item( $pho, 'owner' ) );
428
  if ( ! $user ) {
464
 
465
  // Now the photo is approved, we can mail 'feuploadnotify'
466
  wppa_schedule_mailinglist( 'feuploadnotify', 0, $pho );
467
+
468
  break;
469
 
470
  // A comment on my photo is approved or my comment is approved
471
  case 'commentapproved':
472
+
473
  // Get the comment
474
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
475
 
555
  // Now the comment is approved, we can mail 'commentnotify'
556
  wppa_schedule_mailinglist( 'commentnotify', 0, 0, $com );
557
 
558
+
559
  break;
560
 
561
  case 'commentprevious':
562
+
563
  // Get the comment
564
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
565
 
630
  }
631
  }
632
  }
633
+
634
  break;
635
 
636
  case 'moderatephoto':
637
+
638
  // The subject
639
  $subj = sprintf( __( 'New photo moderate request: %s' , 'wp-photo-album-plus'), wppa_get_photo_item( $pho, 'name' ) );
640
 
696
  wppa_unsubscribe_all( $usr );
697
  }
698
  }
699
+
700
  break;
701
 
702
  case 'moderatecomment':
703
+
704
  // The comment
705
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
706
 
773
  wppa_unsubscribe_all( $usr );
774
  }
775
  }
776
+
777
  break;
778
 
779
  default:
919
  $message_part_2 = '';
920
  $message_part_3 = '';
921
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
922
  $headers = array( 'From: ' . wppa_opt( 'email_from_email' ),
923
  'Content-Type: text/html; charset=UTF-8'
924
  );
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
  }
1002
 
1012
  'Mail sent to: ' . $to . ' (' . $id . ') ' .
1013
  'subject: ' . $subject . ', ' .
1014
  'photo: ' . ( $photo ? ( is_array( $photo ) ? serialize( $photo ) : $photo ) : 'not supplied.' ) );
1015
+ wppa_process_success_mail( $hash );
1016
  return;
1017
  }
1018
 
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
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
wppa-photo-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
- * Version 7.7.03.003
7
  *
8
  */
9
 
@@ -963,7 +963,7 @@ function wppaToggleExif( id, count ) {
963
  echo ' ';
964
 
965
  // Schedule for delete
966
- if ( wppa_user_is( 'administrator' ) || wppa_get_photo_item( $photo, 'owner' ) == wppa_get_user() ) {
967
  $may_change = wppa_user_is( 'administrator' ) || current_user_can( 'wppa_moderate' );
968
 
969
  echo
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 7.7.04.005
7
  *
8
  */
9
 
963
  echo ' ';
964
 
965
  // Schedule for delete
966
+ if ( wppa_user_is( 'administrator' ) || $owner == wppa_get_user() ) {
967
  $may_change = wppa_user_is( 'administrator' ) || current_user_can( 'wppa_moderate' );
968
 
969
  echo
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.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/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '7.7.04.004'; // 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.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
 
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