WP Photo Album Plus - Version 7.7.04.002

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

Code changes from version 7.7.04.001 to 7.7.04.002

Files changed (5) hide show
  1. wppa-audio.php +11 -4
  2. wppa-mailing.php +86 -84
  3. wppa-setup.php +5 -2
  4. wppa-utils.php +2 -2
  5. wppa.php +2 -2
wppa-audio.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all audio routines
6
- * Version 6.9.16
7
  *
8
  */
9
 
@@ -143,9 +143,16 @@ function wppa_get_audio_body( $id, $for_lb = false, $w = '0', $h = '0' ) {
143
  $source = substr( $source, 0, strrpos( $source, '.' ) );
144
  $class = $for_lb ? ' class="wppa-overlay-img"' : '';
145
 
146
- $is_opera = strpos( $_SERVER["HTTP_USER_AGENT"], 'OPR' );
147
- $is_ie = strpos( $_SERVER["HTTP_USER_AGENT"], 'Trident' );
148
- $is_safari = strpos( $_SERVER["HTTP_USER_AGENT"], 'Safari' );
 
 
 
 
 
 
 
149
 
150
  wppa_dbg_msg('Mp3:'.$mp3.', Opera:'.$is_opera.', Ie:'.$is_ie.', Saf:'.$is_safari);
151
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all audio routines
6
+ * Version 7.7.04.002
7
  *
8
  */
9
 
143
  $source = substr( $source, 0, strrpos( $source, '.' ) );
144
  $class = $for_lb ? ' class="wppa-overlay-img"' : '';
145
 
146
+ if ( isset( $_SERVER["HTTP_USER_AGENT"] ) ) {
147
+ $is_opera = strpos( $_SERVER["HTTP_USER_AGENT"], 'OPR' );
148
+ $is_ie = strpos( $_SERVER["HTTP_USER_AGENT"], 'Trident' );
149
+ $is_safari = strpos( $_SERVER["HTTP_USER_AGENT"], 'Safari' );
150
+ }
151
+ else {
152
+ $is_opera = false;
153
+ $is_ie = false;
154
+ $is_safari = false;
155
+ }
156
 
157
  wppa_dbg_msg('Mp3:'.$mp3.', Opera:'.$is_opera.', Ie:'.$is_ie.', Saf:'.$is_safari);
158
 
wppa-mailing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains mailing functions
6
  *
7
- * Version 7.7.04.001
8
  *
9
  */
10
 
@@ -24,6 +24,8 @@ add_action( 'wppa_do_mailinglist_cron', 'wppa_do_mailinglist', 10, 6 );
24
  // Call this function to schedule a mailinglist emission
25
  function wppa_schedule_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url = '', $start = 0, $delay = 120 ) {
26
 
 
 
27
  // If user is an admin and void_admin is active, do nothing
28
  if ( wppa_user_is( 'administrator' ) && wppa_switch( 'void_admin_email' ) ) {
29
  if ( in_array( $type, array( 'newalbumnotify', 'feuploadnotify', 'commentnotify' ) ) ) {
@@ -561,68 +563,71 @@ global $wpdb;
561
  // Get the comment
562
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
563
 
564
- // Get the photo
565
- if ( ! $pho ) {
566
- $pho = $comment['photo'];
567
- }
568
 
569
- // Get teh author
570
- $author = get_user_by( 'login', $comment['user'] );
571
- if ( $author ) {
572
- $aut = $author->display_name;
573
- }
574
- else {
575
- $aut = $comment['user'];
576
- }
577
 
578
- // Get the users who commented on the photo
579
- $users = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT user FROM $wpdb->wppa_comments WHERE photo = %d", $pho ) );
 
 
 
 
 
 
580
 
581
- // If the current author is in the list: remove him, he is most likely already notified
582
- if ( isset( $users[$comment['user']] ) ) {
583
- unset( $users[$comment['user']] );
584
- }
585
 
586
- // Any users left?
587
- if ( empty( $users ) ) {
588
- wppa_log( 'Eml', 'No items for commentprevious mailing' );
589
- wppa_exit();
590
- }
591
 
592
- // The callback url if any
593
- $link = wppa_get_option( 'wppa_mailinglist_callback_url', '' );
 
 
 
594
 
595
- $cont =
596
- $aut . ' ' . __( 'wrote on photo' , 'wp-photo-album-plus' ) . ' ' . wppa_get_photo_name( $comment['photo'] ) . ':' .
597
- '<blockquote style="color:#000077; background-color: #dddddd; border:1px solid black; padding: 6px; border-radius: 4px;" >
598
- <em> ' . stripslashes( $comment['comment'] ) . '</em>
599
- </blockquote>';
600
 
601
- // Preview
602
- if ( $link ) {
603
- $cont .= '<br />' . sprintf( __( 'You can see the photo %shere%s', 'wp-photo-album-plus' ), '<a href="' . $link . '?album=' . $alb . '&photo=' . $pho . '&occur=1' . '" >', '</a>' );
604
- }
 
 
 
 
 
 
605
 
606
- // Process users
607
- foreach( $users as $usr ) {
608
 
609
- $user = get_user_by( 'login', $usr );
610
 
611
- // User still exists?
612
- if ( $user ) {
613
 
614
- wppa_send_mail( array( 'to' => $user->user_email,
615
- 'subj' => sprintf( __( 'Comment on photo %s that you commented earlier' , 'wp-photo-album-plus' ), wppa_get_photo_name( $comment['photo'] ) ),
616
- 'cont' => $cont,
617
- 'photo' => $comment['photo'],
618
- 'replyurl' => $url,
619
- 'listtype' => $type,
620
- 'unsubscribe' => wppa_unsubscribe_link( $usr, $type ),
621
- ));
622
 
623
- }
624
- else {
625
- wppa_unsubscribe_all( $usr );
 
626
  }
627
  }
628
  }
@@ -875,7 +880,7 @@ function wppa_unsubscribe_link( $user_id, $listtype ) {
875
 
876
  // Send a mail
877
  function wppa_send_mail( $args ) {
878
-
879
  $defaults = array( 'to' => '',
880
  'subj' => '',
881
  'cont' => '',
@@ -924,11 +929,15 @@ function wppa_send_mail( $args ) {
924
  if ( $spos > '2' ) {
925
  $site = substr( $site, 0, $spos );
926
  }
927
- */
928
  $headers = array( 'From: ' . wppa_opt( 'email_from_email' ) . ' <' . wppa_opt( 'email_from_email' ) . '>',
929
  'Content-Type: text/html; charset=UTF-8',
930
  'Reply-to: ' . wppa_opt( 'email_from_email' ) . ' <' . wppa_opt( 'email_from_email' ) . '>',
931
  );
 
 
 
 
932
 
933
  $colspan = '1';
934
  if ( is_array( $photo ) ) {
@@ -1011,8 +1020,8 @@ function wppa_send_mail( $args ) {
1011
  );
1012
  if ( $iret ) {
1013
  wppa_log( 'Eml',
1014
- 'Hash: ' . wppa_get_mail_hash( $to, $subject, $message, $headers ) . ', ' .
1015
- 'Mail send to: ' . $to . ' (' . $id . ') ' .
1016
  'subject: ' . $subject . ', ' .
1017
  'photo: ' . ( $photo ? ( is_array( $photo ) ? serialize( $photo ) : $photo ) : 'not supplied.' ) );
1018
  wppa_process_success_mail( $to, $subject, $message, $headers );
@@ -1047,55 +1056,48 @@ function wppa_get_mail_hash( $to = '', $subject = '', $message = '', $headers =
1047
  'commentapproved',
1048
  ),
1049
  '',
1050
- $messsage );
1051
 
1052
  return md5( ( is_array( $to ) ? implode( '|', $to ) : $to ) . $subject . $mes );
1053
  }
1054
 
1055
  // Has mail been sent already?
1056
  function wppa_has_mail_been_sent( $to = '', $subject = '', $message = '', $headers = '' ) {
1057
- global $hasharr;
1058
-
1059
- if ( ! $hasharr ) $hasharr = array();
1060
 
 
1061
  $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
1062
- $sent_mails = get_option( 'wppa_sent_mails' );
1063
- if ( $sent_mails ) {
1064
- $sent_mails = explode( ',', $sent_mails );
1065
- }
1066
- else {
1067
- $sent_mails = array();
1068
- }
1069
 
1070
- $hasharr = array_merge( $hasharr, $sent_mails );
 
1071
 
1072
- if ( in_array( $hash, $hasharr ) ) {
1073
- return true;
 
1074
  }
1075
- return false;
1076
  }
1077
 
1078
  // Register mail has been sent
1079
  function wppa_process_success_mail( $to = '', $subject = '', $message = '', $headers = '' ) {
1080
- global $hasharr;
1081
 
 
1082
  $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
1083
- $sent_mails = get_option( 'wppa_sent_mails' );
1084
- if ( $sent_mails ) {
1085
- $sent_mails = explode( ',', $sent_mails );
1086
- }
1087
- else {
1088
- $sent_mails = array();
1089
- }
1090
- if ( count( $sent_mails ) > 100 ) {
1091
- $sent_mails = array_slice( $sent_mails, 2 );
1092
  }
1093
 
1094
- $hasharr = array_merge( $hasharr, $sent_mails );
1095
- $hasharr[] = $hash;
 
 
1096
 
1097
- $sent_mails = implode( ',', $hasharr );
1098
- update_option( 'wppa_sent_mails', $sent_mails );
1099
  }
1100
 
1101
  // Save failed mail data to retry later
4
  *
5
  * Contains mailing functions
6
  *
7
+ * Version 7.7.04.002
8
  *
9
  */
10
 
24
  // Call this function to schedule a mailinglist emission
25
  function wppa_schedule_mailinglist( $type, $alb = 0, $pho = 0, $com = 0, $url = '', $start = 0, $delay = 120 ) {
26
 
27
+ // wppa_log('eml', 'Schedule mailinglist called: '.$type.' '.$alb.' '.$pho.' '.$com, true);
28
+
29
  // If user is an admin and void_admin is active, do nothing
30
  if ( wppa_user_is( 'administrator' ) && wppa_switch( 'void_admin_email' ) ) {
31
  if ( in_array( $type, array( 'newalbumnotify', 'feuploadnotify', 'commentnotify' ) ) ) {
563
  // Get the comment
564
  $comment = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE id = %d", $com ), ARRAY_A );
565
 
566
+ if ( $comment ) {
 
 
 
567
 
568
+ // Get the photo
569
+ if ( ! $pho ) {
570
+ $pho = $comment['photo'];
571
+ }
 
 
 
 
572
 
573
+ // Get teh author
574
+ $author = get_user_by( 'login', $comment['user'] );
575
+ if ( $author ) {
576
+ $aut = $author->display_name;
577
+ }
578
+ else {
579
+ $aut = $comment['user'];
580
+ }
581
 
582
+ // Get the users who commented on the photo
583
+ $users = $wpdb->get_col( $wpdb->prepare( "SELECT DISTINCT user FROM $wpdb->wppa_comments WHERE photo = %d", $pho ) );
 
 
584
 
585
+ // If the current author is in the list: remove him, he is most likely already notified
586
+ if ( isset( $users[$comment['user']] ) ) {
587
+ unset( $users[$comment['user']] );
588
+ }
 
589
 
590
+ // Any users left?
591
+ if ( empty( $users ) ) {
592
+ wppa_log( 'Eml', 'No items for commentprevious mailing' );
593
+ wppa_exit();
594
+ }
595
 
596
+ // The callback url if any
597
+ $link = wppa_get_option( 'wppa_mailinglist_callback_url', '' );
 
 
 
598
 
599
+ $cont =
600
+ $aut . ' ' . __( 'wrote on photo' , 'wp-photo-album-plus' ) . ' ' . wppa_get_photo_name( $comment['photo'] ) . ':' .
601
+ '<blockquote style="color:#000077; background-color: #dddddd; border:1px solid black; padding: 6px; border-radius: 4px;" >
602
+ <em> ' . stripslashes( $comment['comment'] ) . '</em>
603
+ </blockquote>';
604
+
605
+ // Preview
606
+ if ( $link ) {
607
+ $cont .= '<br />' . sprintf( __( 'You can see the photo %shere%s', 'wp-photo-album-plus' ), '<a href="' . $link . '?album=' . $alb . '&photo=' . $pho . '&occur=1' . '" >', '</a>' );
608
+ }
609
 
610
+ // Process users
611
+ foreach( $users as $usr ) {
612
 
613
+ $user = get_user_by( 'login', $usr );
614
 
615
+ // User still exists?
616
+ if ( $user ) {
617
 
618
+ wppa_send_mail( array( 'to' => $user->user_email,
619
+ 'subj' => sprintf( __( 'Comment on photo %s that you commented earlier' , 'wp-photo-album-plus' ), wppa_get_photo_name( $comment['photo'] ) ),
620
+ 'cont' => $cont,
621
+ 'photo' => $comment['photo'],
622
+ 'replyurl' => $url,
623
+ 'listtype' => $type,
624
+ 'unsubscribe' => wppa_unsubscribe_link( $usr, $type ),
625
+ ));
626
 
627
+ }
628
+ else {
629
+ wppa_unsubscribe_all( $usr );
630
+ }
631
  }
632
  }
633
  }
880
 
881
  // Send a mail
882
  function wppa_send_mail( $args ) {
883
+ wppa_log('eml', 'wppa_send_mail() called with subj '.$args['subj'] );
884
  $defaults = array( 'to' => '',
885
  'subj' => '',
886
  'cont' => '',
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
+ );
941
 
942
  $colspan = '1';
943
  if ( is_array( $photo ) ) {
1020
  );
1021
  if ( $iret ) {
1022
  wppa_log( 'Eml',
1023
+ // 'Hash: ' . wppa_get_mail_hash( $to, $subject, $message, $headers ) . ', ' .
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 );
1056
  'commentapproved',
1057
  ),
1058
  '',
1059
+ $message );
1060
 
1061
  return md5( ( is_array( $to ) ? implode( '|', $to ) : $to ) . $subject . $mes );
1062
  }
1063
 
1064
  // Has mail been sent already?
1065
  function wppa_has_mail_been_sent( $to = '', $subject = '', $message = '', $headers = '' ) {
 
 
 
1066
 
1067
+ // Compute current hash
1068
  $hash = wppa_get_mail_hash( $to, $subject, $message, $headers );
 
 
 
 
 
 
 
1069
 
1070
+ // Get the saved sent mail hashes
1071
+ $sent_mails = get_option( 'wppa_sent_mails', '' );
1072
 
1073
+ $bret = strpos( $sent_mails, $hash ) !== false;
1074
+ if ( $bret ) {
1075
+ wppa_log('eml', 'Mail to '.$to.', subject '.$subject.' has already been sent');
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
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.03.005
7
  *
8
  */
9
 
@@ -653,9 +653,12 @@ global $wppa_error;
653
  $wpdb->query( "UPDATE $wpdb->wppa_albums SET upload_limit_tree = '0' WHERE upload_limit_tree = ''" );
654
  if ( wppa_opt( 'area_size' ) == '' ) delete_option( 'wppa_area_size' );
655
  }
 
 
 
 
656
  }
657
 
658
- // Set Defaults
659
  // wppa_set_defaults();
660
 
661
  // Check required directories
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 7.7.04.002
7
  *
8
  */
9
 
653
  $wpdb->query( "UPDATE $wpdb->wppa_albums SET upload_limit_tree = '0' WHERE upload_limit_tree = ''" );
654
  if ( wppa_opt( 'area_size' ) == '' ) delete_option( 'wppa_area_size' );
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
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.001
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().'['.$_SERVER['REMOTE_ADDR'].']: '.$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.002
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().': '.$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.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/
@@ -24,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '7.7.04.001'; // 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.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
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
+ $wppa_api_version = '7.7.04.002'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30