WP Photo Album Plus - Version 7.1.10.004

Version Description

= 7.1.10 =

  • This version addresses various bug fixes and feature requests.

= 7.1.09 =

  • This version addresses various bug fixes and feature requests.

= 7.1.08 =

  • This version addresses various bug fixes and feature requests.

= 7.1.07 =

  • This version addresses various bug fixes and feature requests.

= 7.1.06 =

  • This version addresses various bug fixes and feature requests.

= 7.1.05 =

  • This version addresses various security issues.
  • This version addresses various bug fixes.

= 7.1.04 =

  • This version addresses various bug fixes.

= 7.1.03 =

  • This version addresses various security issues.
  • This version addresses various bug fixes.

= 7.1.02 =

  • This version addresses various security issues.
  • This version addresses various bug fixes and feature requests.

= 7.1.01 =

  • This version addresses various bug fixes and feature requests.

= 7.1.00 =

  • This version addresses various bug fixes and feature requests.
  • The Photo Album -> Upload Photos and Import Photos admin pages have been substantially improved. Read the changelog for details.

= 7.0.11 =

  • This version addresses various bug fixes and feature requests.

= 7.0.11 =

  • This version addresses various bug fixes

= 7.0.10 =

  • This version addresses various bug fixes

= 7.0.09 =

  • This version addresses various security issues.
  • This version addresses various bug fixes and feature requests.

= 7.0.08 =

  • This version addresses various security issues.
  • This version addresses various bug fixes

= 7.0.07 =

  • This version addresses various security issues.
  • This version addresses various bug fixes

= 7.0.06 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.05 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 7.0.04 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.03 =

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

= 7.0.02 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 7.0.01 =

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

= 7.0.00 =

  • Shortcode generators for Gutenberg added.
  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.
  • To prevent spamming and give the users the opportunity to decide when they want us to email them, the mailing system has been revised. Configure Table IX-M to enable various mailing lists, and use the WPPA+ Notify widget for full user flexibility.

= 6.9.21 =

  • This version addresses various bug fixes
  • This version addresses various security issues.

= 6.9.20 =

  • This version addresses various bug fixes

= 6.9.19 =

  • This version addresses various minor bug fixes

= 6.9.18 =

  • This version addresses various minor bug fixes

= 6.9.17 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.16 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.15 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.14 =

  • This version addresses various minor bug fixes and feature requests.
  • This version addresses various security issues.

= 6.9.13 =

  • Security release.

= 6.9.12 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.11 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.10 =

  • This version addresses various minor bug fixes and performance improvements.

= 6.9.09 =

  • Panorama support phase III.

= 6.9.08 =

  • This version addresses various minor bug fixes and feature requests.
  • Panorama support phase II.

= 6.9.07 =

  • This version addresses various minor bug fixes and feature requests.
  • Panorama support phase I.

= 6.9.06 =

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

= 6.9.05 =

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

= 6.9.04 =

  • This version addresses various minor bug fixes and feature requests.
  • Local CDN functionality has been added.

= 6.9.03 =

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

= 6.9.02 =

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

= 6.9.01 =

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

= 6.9.00 =

  • This version includes the code for the privacy policy requirements.

= 6.8.09

  • This version addresses various bug fixes and code edits.

= 6.8.08 =

  • This version addresses various minor bug fixes and feature requests.
  • This version offers substantial performance improvements when the box in Table IV-A13: Defer Javascript is ticked. This setting is now recommended and set ticked as the default.
  • For more info on performance improvements and compatibility with optimizers: see the changelog.txt

= 6.8.07 =

  • This version addresses various minor bug fixes and enhancements, and a new widget: Statistics.

= 6.8.06 =

  • This version addresses various minor bug fixes and improved cache handling.

= 6.8.05 =

  • This version addresses various minor bug fixes and feture requests.

= 6.8.04 =

  • This version addresses various display issues and a few fixes of bugs that seldom affected the plugins behaviour.
Download this release

Release Info

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

Code changes from version 7.1.10.003 to 7.1.10.004

changelog.txt CHANGED
@@ -4,6 +4,8 @@ WP Photo Album Plus Changelog
4
 
5
  * Failed attempts to create a directory tree will no longer result in a blank screen.
6
  * Added a selection option to the photo of the day subtitle. Displays photo and album names and descriptions.
 
 
7
 
8
  = 7.1.09 =
9
 
4
 
5
  * Failed attempts to create a directory tree will no longer result in a blank screen.
6
  * Added a selection option to the photo of the day subtitle. Displays photo and album names and descriptions.
7
+ * Added 'non-zero only' checkbox in Table I-F1, to select only rated/viewed photos in the topten selection.
8
+ * Fixed a possible sql error in the topten widget.
9
 
10
  = 7.1.09 =
11
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
- Version: 7.1.10.001
6
  Stable tag: 7.1.09.004
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
@@ -137,6 +137,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
137
 
138
  == Upgrade Notice ==
139
 
 
 
 
 
140
  = 7.1.09 =
141
 
142
  * This version addresses various bug fixes and feature requests.
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 7.1.10.004
6
  Stable tag: 7.1.09.004
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
137
 
138
  == Upgrade Notice ==
139
 
140
+ = 7.1.10 =
141
+
142
+ * This version addresses various bug fixes and feature requests.
143
+
144
  = 7.1.09 =
145
 
146
  * This version addresses various bug fixes and feature requests.
wppa-admin-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
- * Version 7.1.05
7
  *
8
  */
9
 
@@ -499,13 +499,13 @@ function _wppa_sanitze_files( $root ) {
499
  $count = '0';
500
  if ( $files ) foreach ( $files as $file ) {
501
 
502
- if ( is_file( $file ) ) {
503
 
504
  // Check extension
505
  $ext = strtolower( wppa_get_ext( $file ) );
506
  if ( ! in_array( $ext, $allowed_types ) ) {
507
  if ( basename( $file ) != 'index.php' ) {
508
- unlink( $file );
509
  wppa_error_message( sprintf( __( 'File %s is of an unsupported filetype and has been removed.' , 'wp-photo-album-plus'), basename( wppa_sanitize_file_name( $file ) ) ) );
510
  }
511
  $count++;
@@ -714,7 +714,7 @@ global $warning_given_small;
714
  $exists = wppa_is_file_duplicate_photo( $filename, $alb );
715
  if ( $exists ) {
716
  if ( isset( $_POST['del-after-p'] ) ) {
717
- unlink( $file );
718
  $msg = __( 'Photo %s already exists in album number %s. Removed from depot.' , 'wp-photo-album-plus');
719
  }
720
  else {
@@ -742,7 +742,7 @@ global $warning_given_small;
742
  elseif ( wppa( 'is_remote' ) ) {
743
  if ( ! wppa_is_url_a_photo( $file ) ) {
744
  if ( wppa( 'ajax' ) ) {
745
- wppa( 'ajax_import_files_error', __( 'Not found', 'wp-photo-album-plus') );
746
  }
747
  return false;
748
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * gp admin functions
6
+ * Version 7.1.10
7
  *
8
  */
9
 
499
  $count = '0';
500
  if ( $files ) foreach ( $files as $file ) {
501
 
502
+ if ( wppa_is_file( $file ) ) {
503
 
504
  // Check extension
505
  $ext = strtolower( wppa_get_ext( $file ) );
506
  if ( ! in_array( $ext, $allowed_types ) ) {
507
  if ( basename( $file ) != 'index.php' ) {
508
+ wppa_unlink( $file );
509
  wppa_error_message( sprintf( __( 'File %s is of an unsupported filetype and has been removed.' , 'wp-photo-album-plus'), basename( wppa_sanitize_file_name( $file ) ) ) );
510
  }
511
  $count++;
714
  $exists = wppa_is_file_duplicate_photo( $filename, $alb );
715
  if ( $exists ) {
716
  if ( isset( $_POST['del-after-p'] ) ) {
717
+ wppa_unlink( $file );
718
  $msg = __( 'Photo %s already exists in album number %s. Removed from depot.' , 'wp-photo-album-plus');
719
  }
720
  else {
742
  elseif ( wppa( 'is_remote' ) ) {
743
  if ( ! wppa_is_url_a_photo( $file ) ) {
744
  if ( wppa( 'ajax' ) ) {
745
+ wppa( 'ajax_import_files_error', '...' . substr( $file, -16 ) . ' ' . __( 'Not found', 'wp-photo-album-plus') );
746
  }
747
  return false;
748
  }
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.1.06
7
  *
8
  */
9
 
@@ -1236,10 +1236,20 @@ global $wppa_session;
1236
  }
1237
  if ( ! is_user_logged_in() ) $status .= " AND status <> 'private'";
1238
 
 
 
 
 
 
 
 
 
 
1239
  $query = "SELECT * FROM $wpdb->wppa_photos " .
1240
  "WHERE $album_clause AND ( $status ) " .
 
1241
  "ORDER BY $sortby LIMIT $max";
1242
-
1243
  $count_first = false;
1244
  }
1245
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 7.1.10
7
  *
8
  */
9
 
1236
  }
1237
  if ( ! is_user_logged_in() ) $status .= " AND status <> 'private'";
1238
 
1239
+ $non_zero = "";
1240
+ if ( wppa_switch( 'topten_non_zero' ) ) {
1241
+ if ( wppa_opt( 'topten_sortby' ) == 'views' ) {
1242
+ $non_zero = "AND views > 0 ";
1243
+ }
1244
+ else {
1245
+ $non_zero = "AND rating_count > 0 ";
1246
+ }
1247
+ }
1248
  $query = "SELECT * FROM $wpdb->wppa_photos " .
1249
  "WHERE $album_clause AND ( $status ) " .
1250
+ $non_zero .
1251
  "ORDER BY $sortby LIMIT $max";
1252
+ wppa_log('dbg',$query);
1253
  $count_first = false;
1254
  }
1255
 
wppa-import.php CHANGED
@@ -1186,7 +1186,7 @@ global $wppa_session;
1186
  '&nbsp;&nbsp;' .
1187
  '<b>' .
1188
  wppa_sanitize_file_name( basename( $csv ) ) .
1189
- ' (' . sprintf( '%3.1f', filesize( $csv ) / 1024 ) . ' kb)' .
1190
  '</b>' .
1191
  '</td>' .
1192
  '</tr>';
@@ -1286,7 +1286,7 @@ global $wppa_session;
1286
  ' >' .
1287
  '&nbsp;&nbsp;' .
1288
  wppa_sanitize_file_name( basename( $pdf ) ) .
1289
- ' (' . sprintf( '%3.1f', filesize( $pdf ) / 1024 ) . ' kb)' .
1290
  '</span>' .
1291
  '</td>';
1292
  if ( $ct == 3 ) {
@@ -2111,6 +2111,7 @@ global $wppa_session;
2111
  else {
2112
  $id = substr( $id, 0, strpos( $id, '.' ) );
2113
  if ( ! is_numeric( $id ) || ! wppa_is_id_free( WPPA_PHOTOS, $id ) ) $id = 0;
 
2114
  $id = wppa_insert_photo( $unsanitized_path_name, $alb, stripslashes( $name ), stripslashes( $desc ), $porder, $id, stripslashes( $linkurl ), stripslashes( $linktitle ) );
2115
  if ( $id ) {
2116
  if ( wppa( 'ajax' ) ) {
@@ -2132,6 +2133,12 @@ global $wppa_session;
2132
  if ( ( ! $wppa_session['is_wppa_tree'] && wppa_is_url_a_photo( $setting ) ) || wppa_is_url_a_photo( $setting_x ) ) {
2133
  update_option( 'wppa_import_source_url_' . wppa_get_user(), wppa_compress_tree_path( $unsanitized_path_name ) );
2134
  }
 
 
 
 
 
 
2135
  }
2136
  }
2137
  else {
@@ -2139,6 +2146,12 @@ global $wppa_session;
2139
  if ( $delf ) {
2140
  wppa_unlink( $unsanitized_path_name );
2141
  }
 
 
 
 
 
 
2142
  }
2143
  }
2144
  }
1186
  '&nbsp;&nbsp;' .
1187
  '<b>' .
1188
  wppa_sanitize_file_name( basename( $csv ) ) .
1189
+ ' (' . sprintf( '%3.1f', wppa_filesize( $csv ) / 1024 ) . ' kb)' .
1190
  '</b>' .
1191
  '</td>' .
1192
  '</tr>';
1286
  ' >' .
1287
  '&nbsp;&nbsp;' .
1288
  wppa_sanitize_file_name( basename( $pdf ) ) .
1289
+ ' (' . sprintf( '%3.1f', wppa_filesize( $pdf ) / 1024 ) . ' kb)' .
1290
  '</span>' .
1291
  '</td>';
1292
  if ( $ct == 3 ) {
2111
  else {
2112
  $id = substr( $id, 0, strpos( $id, '.' ) );
2113
  if ( ! is_numeric( $id ) || ! wppa_is_id_free( WPPA_PHOTOS, $id ) ) $id = 0;
2114
+ wppa_log('dbg','unpathname='.$unsanitized_path_name);
2115
  $id = wppa_insert_photo( $unsanitized_path_name, $alb, stripslashes( $name ), stripslashes( $desc ), $porder, $id, stripslashes( $linkurl ), stripslashes( $linktitle ) );
2116
  if ( $id ) {
2117
  if ( wppa( 'ajax' ) ) {
2133
  if ( ( ! $wppa_session['is_wppa_tree'] && wppa_is_url_a_photo( $setting ) ) || wppa_is_url_a_photo( $setting_x ) ) {
2134
  update_option( 'wppa_import_source_url_' . wppa_get_user(), wppa_compress_tree_path( $unsanitized_path_name ) );
2135
  }
2136
+
2137
+ $path = WPPA_DEPOT_PATH . '/' . basename( wppa_compress_tree_path( $unsanitized_path_name ) );
2138
+ if ( is_file( $path ) ) {
2139
+ wppa_unlink( $path );
2140
+ wppa_log('dbg', $path . ' removed' );
2141
+ }
2142
  }
2143
  }
2144
  else {
2146
  if ( $delf ) {
2147
  wppa_unlink( $unsanitized_path_name );
2148
  }
2149
+ if ( wppa( 'is_remote' ) ) {
2150
+ $path = WPPA_DEPOT_PATH . '/' . basename( wppa_compress_tree_path( $unsanitized_path_name ) );
2151
+ if ( is_file( $path ) ) {
2152
+ wppa( 'ajax_import_files_error', __( 'Saved to depot', 'wp-photo-album-plus') );
2153
+ }
2154
+ }
2155
  }
2156
  }
2157
  }
wppa-photo-files.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
- * Version 7.1.08
6
  *
7
  */
8
 
@@ -47,7 +47,7 @@ function wppa_make_o1_source( $id ) {
47
 
48
  // Correct orientation
49
  if ( ! wppa_orientate_image_file( $dst_path, $orient ) ) {
50
- unlink( $dst_path );
51
  return false;
52
  }
53
  }
@@ -711,7 +711,7 @@ global $wpdb;
711
  // Does photo exist?
712
  $photo = wppa_cache_photo( $arg );
713
  if ( ! $photo ) {
714
- wppa_log( 'Err', 'Non existent photo item: ' . $arg . ' in wppa_convert_png_to_jpg()' );
715
  return false;
716
  }
717
  $id = $photo['id'];
2
  /* wppa-photo-files.php
3
  *
4
  * Functions used to create/manipulate photofiles
5
+ * Version 7.1.10
6
  *
7
  */
8
 
47
 
48
  // Correct orientation
49
  if ( ! wppa_orientate_image_file( $dst_path, $orient ) ) {
50
+ wppa_unlink( $dst_path );
51
  return false;
52
  }
53
  }
711
  // Does photo exist?
712
  $photo = wppa_cache_photo( $arg );
713
  if ( ! $photo ) {
714
+ wppa_log( 'Err', 'Non existent photo: ' . $arg . ' in wppa_convert_png_to_jpg()' );
715
  return false;
716
  }
717
  $id = $photo['id'];
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 7.1.09
7
  *
8
  */
9
 
@@ -1429,11 +1429,13 @@ global $wppa_supported_camara_brands;
1429
  $name = __('TopTen count', 'wp-photo-album-plus');
1430
  $desc = __('Number of photos in TopTen widget.', 'wp-photo-album-plus');
1431
  $help = (__('Enter the maximum number of rated photos in the TopTen widget.', 'wp-photo-album-plus'));
1432
- $slug = 'wppa_topten_count';
1433
- $html = wppa_input($slug, '40px', '', __('photos', 'wp-photo-album-plus'));
 
 
1434
  $clas = 'wppa_rating';
1435
  $tags = 'count,widget';
1436
- wppa_setting($slug, '1', $name, $desc, $html, $help, $clas, $tags);
1437
 
1438
  $name = __('TopTen size', 'wp-photo-album-plus');
1439
  $desc = __('Size of thumbnails in TopTen widget.', 'wp-photo-album-plus');
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.1.10
7
  *
8
  */
9
 
1429
  $name = __('TopTen count', 'wp-photo-album-plus');
1430
  $desc = __('Number of photos in TopTen widget.', 'wp-photo-album-plus');
1431
  $help = (__('Enter the maximum number of rated photos in the TopTen widget.', 'wp-photo-album-plus'));
1432
+ $slug1 = 'wppa_topten_count';
1433
+ $html1 = wppa_input($slug1, '40px', '', __('photos', 'wp-photo-album-plus'));
1434
+ $slug2 = 'wppa_topten_non_zero';
1435
+ $html2 = wppa_checkbox($slug2).__('Non zero only', 'wp-photo-album-plus');
1436
  $clas = 'wppa_rating';
1437
  $tags = 'count,widget';
1438
+ wppa_setting($slug1, '1', $name, $desc, $html1.$html2, $help, $clas, $tags);
1439
 
1440
  $name = __('TopTen size', 'wp-photo-album-plus');
1441
  $desc = __('Size of thumbnails in TopTen widget.', 'wp-photo-album-plus');
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 7.1.09
7
  *
8
  */
9
 
@@ -887,6 +887,7 @@ cursorborder:'2px solid transparent',";
887
 
888
  // F Widgets
889
  'wppa_topten_count' => '10', // 1
 
890
  'wppa_topten_size' => '86', // 2
891
  'wppa_comten_count' => '10', // 3
892
  'wppa_comten_size' => '86', // 4
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 7.1.10
7
  *
8
  */
9
 
887
 
888
  // F Widgets
889
  'wppa_topten_count' => '10', // 1
890
+ 'wppa_topten_non_zero' => 'no',
891
  'wppa_topten_size' => '86', // 2
892
  'wppa_comten_count' => '10', // 3
893
  'wppa_comten_size' => '86', // 4
wppa-topten-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
- * Version 6.9.21
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
@@ -78,11 +78,22 @@ class TopTenWidget extends WP_Widget {
78
 
79
  $likes = wppa_opt( 'rating_display_type' ) == 'likes';
80
 
81
- // When likes only, mean rating has no meaning, chan to (rating)(like)count
82
  if ( $likes && $instance['sortby'] == 'mean_rating' ) {
83
  $instance['sortby'] = 'rating_count';
84
  }
85
 
 
 
 
 
 
 
 
 
 
 
 
86
  // Album specified?
87
  if ( $album ) {
88
 
@@ -121,7 +132,8 @@ class TopTenWidget extends WP_Widget {
121
  $query = "SELECT * FROM $wpdb->wppa_photos
122
  WHERE album IN ( aaaa )
123
  AND status IN ( 'gold', 'silver', 'bronze' )
124
- ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
 
125
  LIMIT %d";
126
  break;
127
 
@@ -129,6 +141,7 @@ class TopTenWidget extends WP_Widget {
129
  $query = "SELECT * FROM $wpdb->wppa_photos
130
  WHERE album IN ( aaaa )
131
  AND status IN ( 'gold', 'silver', 'bronze' )
 
132
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
133
  LIMIT %d";
134
  break;
@@ -138,6 +151,7 @@ class TopTenWidget extends WP_Widget {
138
  $query = "SELECT * FROM $wpdb->wppa_photos
139
  WHERE album IN ( aaaa )
140
  AND status IN ( 'gold', 'silver', 'bronze' )
 
141
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
142
  LIMIT %d";
143
  break;
@@ -152,13 +166,15 @@ class TopTenWidget extends WP_Widget {
152
  case 'rating_count':
153
  $query = "SELECT * FROM $wpdb->wppa_photos
154
  WHERE album IN ( aaaa )
155
- ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
 
156
  LIMIT %d";
157
  break;
158
 
159
  case 'views':
160
  $query = "SELECT * FROM $wpdb->wppa_photos
161
  WHERE album IN ( aaaa )
 
162
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
163
  LIMIT %d";
164
  break;
@@ -167,6 +183,7 @@ class TopTenWidget extends WP_Widget {
167
  default:
168
  $query = "SELECT * FROM $wpdb->wppa_photos
169
  WHERE album IN ( aaaa )
 
170
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
171
  LIMIT %d";
172
  break;
@@ -185,7 +202,8 @@ class TopTenWidget extends WP_Widget {
185
  $query = "SELECT * FROM $wpdb->wppa_photos
186
  WHERE album > 0
187
  AND status IN ( 'gold', 'silver', 'bronze' )
188
- ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
 
189
  LIMIT %d";
190
  break;
191
 
@@ -193,6 +211,7 @@ class TopTenWidget extends WP_Widget {
193
  $query = "SELECT * FROM $wpdb->wppa_photos
194
  WHERE album > 0
195
  AND status IN ( 'gold', 'silver', 'bronze' )
 
196
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
197
  LIMIT %d";
198
  break;
@@ -202,6 +221,7 @@ class TopTenWidget extends WP_Widget {
202
  $query = "SELECT * FROM $wpdb->wppa_photos
203
  WHERE album > 0
204
  AND status IN ( 'gold', 'silver', 'bronze' )
 
205
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
206
  LIMIT %d";
207
  break;
@@ -216,13 +236,15 @@ class TopTenWidget extends WP_Widget {
216
  case 'rating_count':
217
  $query = "SELECT * FROM $wpdb->wppa_photos
218
  WHERE album > 0
219
- ORDER BY rating_count DESC, mean_rating DESC, views DESC DESC
 
220
  LIMIT %d";
221
  break;
222
 
223
  case 'views':
224
  $query = "SELECT * FROM $wpdb->wppa_photos
225
  WHERE album > 0
 
226
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
227
  LIMIT %d";
228
  break;
@@ -231,11 +253,13 @@ class TopTenWidget extends WP_Widget {
231
  default:
232
  $query = "SELECT * FROM $wpdb->wppa_photos
233
  WHERE album > 0
 
234
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
235
  LIMIT %d";
236
  break;
237
 
238
  }
 
239
  $thumbs = $wpdb->get_results( $wpdb->prepare( $query, $max ), ARRAY_A );
240
  }
241
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
+ * Version 7.1.10
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
78
 
79
  $likes = wppa_opt( 'rating_display_type' ) == 'likes';
80
 
81
+ // When likes only, mean rating has no meaning, change to (rating)(like)count
82
  if ( $likes && $instance['sortby'] == 'mean_rating' ) {
83
  $instance['sortby'] = 'rating_count';
84
  }
85
 
86
+ // Non-zero
87
+ $non_zero = "";
88
+ if ( wppa_switch( 'topten_non_zero' ) ) {
89
+ if ( wppa_opt( 'topten_sortby' ) == 'views' ) {
90
+ $non_zero = "AND views > 0 ";
91
+ }
92
+ else {
93
+ $non_zero = "AND rating_count > 0 ";
94
+ }
95
+ }
96
+
97
  // Album specified?
98
  if ( $album ) {
99
 
132
  $query = "SELECT * FROM $wpdb->wppa_photos
133
  WHERE album IN ( aaaa )
134
  AND status IN ( 'gold', 'silver', 'bronze' )
135
+ $non_zero
136
+ ORDER BY rating_count DESC, mean_rating DESC, views DESC
137
  LIMIT %d";
138
  break;
139
 
141
  $query = "SELECT * FROM $wpdb->wppa_photos
142
  WHERE album IN ( aaaa )
143
  AND status IN ( 'gold', 'silver', 'bronze' )
144
+ $non_zero
145
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
146
  LIMIT %d";
147
  break;
151
  $query = "SELECT * FROM $wpdb->wppa_photos
152
  WHERE album IN ( aaaa )
153
  AND status IN ( 'gold', 'silver', 'bronze' )
154
+ $non_zero
155
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
156
  LIMIT %d";
157
  break;
166
  case 'rating_count':
167
  $query = "SELECT * FROM $wpdb->wppa_photos
168
  WHERE album IN ( aaaa )
169
+ $non_zero
170
+ ORDER BY rating_count DESC, mean_rating DESC, views DESC
171
  LIMIT %d";
172
  break;
173
 
174
  case 'views':
175
  $query = "SELECT * FROM $wpdb->wppa_photos
176
  WHERE album IN ( aaaa )
177
+ $non_zero
178
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
179
  LIMIT %d";
180
  break;
183
  default:
184
  $query = "SELECT * FROM $wpdb->wppa_photos
185
  WHERE album IN ( aaaa )
186
+ $non_zero
187
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
188
  LIMIT %d";
189
  break;
202
  $query = "SELECT * FROM $wpdb->wppa_photos
203
  WHERE album > 0
204
  AND status IN ( 'gold', 'silver', 'bronze' )
205
+ $non_zero
206
+ ORDER BY rating_count DESC, mean_rating DESC, views DESC
207
  LIMIT %d";
208
  break;
209
 
211
  $query = "SELECT * FROM $wpdb->wppa_photos
212
  WHERE album > 0
213
  AND status IN ( 'gold', 'silver', 'bronze' )
214
+ $non_zero
215
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
216
  LIMIT %d";
217
  break;
221
  $query = "SELECT * FROM $wpdb->wppa_photos
222
  WHERE album > 0
223
  AND status IN ( 'gold', 'silver', 'bronze' )
224
+ $non_zero
225
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
226
  LIMIT %d";
227
  break;
236
  case 'rating_count':
237
  $query = "SELECT * FROM $wpdb->wppa_photos
238
  WHERE album > 0
239
+ $non_zero
240
+ ORDER BY rating_count DESC, mean_rating DESC, views DESC
241
  LIMIT %d";
242
  break;
243
 
244
  case 'views':
245
  $query = "SELECT * FROM $wpdb->wppa_photos
246
  WHERE album > 0
247
+ $non_zero
248
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
249
  LIMIT %d";
250
  break;
253
  default:
254
  $query = "SELECT * FROM $wpdb->wppa_photos
255
  WHERE album > 0
256
+ $non_zero
257
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
258
  LIMIT %d";
259
  break;
260
 
261
  }
262
+ wppa_log('dbg', $query);
263
  $thumbs = $wpdb->get_results( $wpdb->prepare( $query, $max ), ARRAY_A );
264
  }
265
  }
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.1.09
7
  *
8
  */
9
 
@@ -975,7 +975,7 @@ function wppa_get_imgalt( $id, $lb = false ) {
975
  function wppa_is_time_up( $count = '' ) {
976
  global $wppa_endtime;
977
 
978
- wppa_log( 'Dbg', 'Timeleft = ' . ( $wppa_endtime - time() ) );
979
 
980
  // Time up?
981
  if ( $wppa_endtime > time() ) {
@@ -1705,7 +1705,7 @@ global $wpdb;
1705
  function wppa_get_filesize( $file ) {
1706
 
1707
  if ( is_file( $file ) ) {
1708
- $fs = filesize( $file );
1709
 
1710
  if ( $fs > 1024*1024 ) {
1711
  $fs = sprintf('%4.2f Mb', $fs/(1024*1024));
@@ -4758,21 +4758,28 @@ function wppa_remote_file_exists( &$url ) {
4758
  $orig_url = $url;
4759
  $ext = wppa_get_ext( $url );
4760
  $url_1 = wppa_strip_ext( $url );
4761
- $exts = array( $ext );
4762
- if ( $ext == 'jpg' ) {
4763
- $exts[] = 'png';
4764
- }
4765
 
4766
  for ( $i=1; $i<4; $i++ ) { // Give it four tries
4767
  foreach( $exts as $ext ) { // Try all possible extensions
 
4768
  $url = $url_1 . '.' . $ext;
4769
  $ch = curl_init( $url );
4770
- curl_setopt( $ch, CURLOPT_NOBODY, true );
4771
- curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, true );
 
 
 
4772
  curl_exec( $ch );
4773
- $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
4774
  curl_close( $ch );
4775
- if( $httpCode == 200 ) {
 
 
 
 
 
 
4776
  return true;
4777
  }
4778
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.1.10
7
  *
8
  */
9
 
975
  function wppa_is_time_up( $count = '' ) {
976
  global $wppa_endtime;
977
 
978
+ // wppa_log( 'Dbg', 'Timeleft = ' . ( $wppa_endtime - time() ) );
979
 
980
  // Time up?
981
  if ( $wppa_endtime > time() ) {
1705
  function wppa_get_filesize( $file ) {
1706
 
1707
  if ( is_file( $file ) ) {
1708
+ $fs = wppa_filesize( $file );
1709
 
1710
  if ( $fs > 1024*1024 ) {
1711
  $fs = sprintf('%4.2f Mb', $fs/(1024*1024));
4758
  $orig_url = $url;
4759
  $ext = wppa_get_ext( $url );
4760
  $url_1 = wppa_strip_ext( $url );
4761
+ $exts = array( 'jpg', 'png' );
 
 
 
4762
 
4763
  for ( $i=1; $i<4; $i++ ) { // Give it four tries
4764
  foreach( $exts as $ext ) { // Try all possible extensions
4765
+
4766
  $url = $url_1 . '.' . $ext;
4767
  $ch = curl_init( $url );
4768
+ $options = array(
4769
+ CURLOPT_NOBODY => true,
4770
+ CURLOPT_SSL_VERIFYPEER => true,
4771
+ );
4772
+ curl_setopt_array( $ch, $options );
4773
  curl_exec( $ch );
4774
+ $httpCode = curl_getinfo( $ch, CURLINFO_HTTP_CODE );
4775
  curl_close( $ch );
4776
+ wppa_log( 'dbg', 'curl_exec() returned {b}' . $httpCode . '{/b} for ' . $url );
4777
+ if ( $httpCode == 200 ) {
4778
+ $path = WPPA_DEPOT_PATH . '/' . basename( wppa_compress_tree_path( $url ) );
4779
+ if ( ! wppa_is_file( $path ) || ! wppa_filesize( $path ) ) {
4780
+ $data = file_get_contents( $url );
4781
+ file_put_contents( $path, $data );
4782
+ }
4783
  return true;
4784
  }
4785
  }
wppa-wrappers.php CHANGED
@@ -267,14 +267,14 @@ function wppa_unlink( $file ) {
267
 
268
  // Make directory tree recursively
269
  function wppa_mktree( $path ) {
270
-
271
  $bret = _wppa_mktree( $path );
272
  if ( ! $bret ) {
273
  wppa_log( 'Err', 'Could not create ' . $path );
274
  }
275
  return $bret;
276
  }
277
-
278
  function _wppa_mktree( $path ) {
279
 
280
  if ( wppa_is_dir( $path ) ) {
@@ -434,13 +434,13 @@ function wppa_put_contents( $path, $contents, $log = true ) {
434
  if ( ! $fp )
435
  return false;
436
 
437
- mbstring_binary_safe_encoding();
438
 
439
  $data_length = strlen( $contents );
440
 
441
  $bytes_written = fwrite( $fp, $contents );
442
 
443
- reset_mbstring_encoding();
444
 
445
  fclose( $fp );
446
 
267
 
268
  // Make directory tree recursively
269
  function wppa_mktree( $path ) {
270
+
271
  $bret = _wppa_mktree( $path );
272
  if ( ! $bret ) {
273
  wppa_log( 'Err', 'Could not create ' . $path );
274
  }
275
  return $bret;
276
  }
277
+
278
  function _wppa_mktree( $path ) {
279
 
280
  if ( wppa_is_dir( $path ) ) {
434
  if ( ! $fp )
435
  return false;
436
 
437
+ // mbstring_binary_safe_encoding();
438
 
439
  $data_length = strlen( $contents );
440
 
441
  $bytes_written = fwrite( $fp, $contents );
442
 
443
+ // reset_mbstring_encoding();
444
 
445
  fclose( $fp );
446
 
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.1.10.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/
@@ -22,8 +22,8 @@ global $wpdb;
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
- global $wppa_revno; $wppa_revno = '7109'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.1.10.003'; // WPPA software version
27
 
28
  /* Init page js data */
29
  global $wppa_js_page_data; $wppa_js_page_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: 7.1.10.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/
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
+ global $wppa_revno; $wppa_revno = '7110'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.1.10.004'; // WPPA software version
27
 
28
  /* Init page js data */
29
  global $wppa_js_page_data; $wppa_js_page_data = '';