WP Photo Album Plus - Version 8.0.04.004

Version Description

= 8.0.03 =

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

Code changes from version 8.0.04.003 to 8.0.04.004

changelog.txt CHANGED
@@ -2,13 +2,16 @@ WP Photo Album Plus Changelog
2
 
3
  = 8.0.04 =
4
 
5
- * Settings page will no longer crash when the php implementation does not support thye exec() command.
6
  * Fixed inconsistent behaviour of 'slideshow wrap around' feature.
7
  * Improved behaviour of popup thumbnails. They come up now correctly.
8
  * New setting: Basic settings -> Slideshow -> IV -> Item 14: Easing formula.
9
  * New setting: Basic settings -> Lightbox -> I -> Item 28: Easing formula.
10
  * New setting: Basic settings -> Thumbnails -> III -> Item 9: Popup easing formula.
11
  * You can now combine thumbnail popups with all available thumbnail links, so also lightbox.
 
 
 
12
 
13
  = 8.0.03 =
14
 
2
 
3
  = 8.0.04 =
4
 
5
+ * Settings page will no longer crash when the php implementation does not support the exec() command.
6
  * Fixed inconsistent behaviour of 'slideshow wrap around' feature.
7
  * Improved behaviour of popup thumbnails. They come up now correctly.
8
  * New setting: Basic settings -> Slideshow -> IV -> Item 14: Easing formula.
9
  * New setting: Basic settings -> Lightbox -> I -> Item 28: Easing formula.
10
  * New setting: Basic settings -> Thumbnails -> III -> Item 9: Popup easing formula.
11
  * You can now combine thumbnail popups with all available thumbnail links, so also lightbox.
12
+ * Albums now have a status. Publish is the default, Private: only visible to loggedin visitors, Hidden: only visible to admin and superusers.
13
+ * Mailing unsubscribe links failed. Fixed.
14
+ * Improved algorithm to clear non-wppa caches.
15
 
16
  = 8.0.03 =
17
 
theme/wppa-theme.php CHANGED
@@ -3,13 +3,14 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the albums/photos/slideshow in a page or post
6
- * Version 8.0.04.003
7
  */
8
  function wppa_theme() {
9
 
10
- global $wppa_version; $wppa_version = '8.0.04.003'; // The version number of this file
11
  global $wppa;
12
  global $wppa_show_statistics; // Can be set to true by a custom page template
 
13
 
14
  $curpage = wppa_get_curpage(); // Get the page # we are on when pagination is on, or 1
15
  $didsome = false; // Required initializations for pagination
@@ -451,6 +452,7 @@ global $wppa_show_statistics; // Can be set to true by a custom page templa
451
  wppa_out( wppa_errorbox( __( 'No albums or photos found matching your search criteria.', 'wp-photo-album-plus' ) ) );
452
  wppa_report_nothing(3);
453
  }
 
454
  }
455
  } // wppa_page( 'albums' )
456
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the albums/photos/slideshow in a page or post
6
+ * Version 8.0.04.004
7
  */
8
  function wppa_theme() {
9
 
10
+ global $wppa_version; $wppa_version = '8.0.04.004'; // The version number of this file
11
  global $wppa;
12
  global $wppa_show_statistics; // Can be set to true by a custom page template
13
+ global $wppa_empty_content;
14
 
15
  $curpage = wppa_get_curpage(); // Get the page # we are on when pagination is on, or 1
16
  $didsome = false; // Required initializations for pagination
452
  wppa_out( wppa_errorbox( __( 'No albums or photos found matching your search criteria.', 'wp-photo-album-plus' ) ) );
453
  wppa_report_nothing(3);
454
  }
455
+ $wppa_empty_content = true;
456
  }
457
  } // wppa_page( 'albums' )
458
 
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 8.0.02.007
6
  *
7
  */
8
 
@@ -931,7 +931,7 @@ global $wppa;
931
  // Remove all User-<userid> tags
932
  $tag = 'user-' . wppa_get_user( 'id' );
933
  $items = $wpdb->get_results( "SELECT id, tags FROM $wpdb->wppa_photos
934
- WHERE tags LIKE '%," . $tag . ",%'", ARRAY_A );
935
  foreach( $items as $item ) {
936
  $id = $item['id'];
937
  $tags = preg_replace( '/,'.$tag.',/siu', ',', $tags );
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 8.0.04.004
6
  *
7
  */
8
 
931
  // Remove all User-<userid> tags
932
  $tag = 'user-' . wppa_get_user( 'id' );
933
  $items = $wpdb->get_results( "SELECT id, tags FROM $wpdb->wppa_photos
934
+ WHERE tags LIKE '%,".$wpdb->esc_like($tag).",%'", ARRAY_A );
935
  foreach( $items as $item ) {
936
  $id = $item['id'];
937
  $tags = preg_replace( '/,'.$tag.',/siu', ',', $tags );
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 8.0.02.006
7
  *
8
  */
9
 
@@ -416,6 +416,7 @@ global $wppa_revno;
416
  $zoomable = $albuminfo['zoomable'];
417
  $displayopts = $albuminfo['displayopts'];
418
  $scheduledel = $albuminfo['scheduledel'];
 
419
 
420
  $treecounts = wppa_get_treecounts_a( $id, true );
421
  $pviews = $treecounts['selfphotoviews'];
@@ -627,6 +628,21 @@ global $wppa_revno;
627
  '</small>' . ' ';
628
  }
629
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
630
  // Parent
631
  echo
632
  __( 'Parent album', 'wp-photo-album-plus' ) . ':&nbsp;';
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
416
  $zoomable = $albuminfo['zoomable'];
417
  $displayopts = $albuminfo['displayopts'];
418
  $scheduledel = $albuminfo['scheduledel'];
419
+ $status = $albuminfo['status'];
420
 
421
  $treecounts = wppa_get_treecounts_a( $id, true );
422
  $pviews = $treecounts['selfphotoviews'];
628
  '</small>' . ' ';
629
  }
630
 
631
+ // Status
632
+ echo
633
+ __( 'Status', 'wp-photo-album-plus' ) . ':&nbsp;
634
+ <select onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'status\', this )" >
635
+ <option value="publish"' . ( $status == 'publish' ? ' selected' : '' ) . ' >' .
636
+ __( 'Publish', 'wp-photo-album-plus' ) . '
637
+ </option>
638
+ <option value="private"' . ( $status == 'private' ? ' selected' : '' ) . ' >' .
639
+ __( 'Private', 'wp-photo-album-plus' ) . '
640
+ </option>
641
+ <option value="hidden"' . ( $status == 'hidden' ? ' selected' : '' ) . ' >' .
642
+ __( 'Hidden', 'wp-photo-album-plus' ) . '
643
+ </option>
644
+ </select>&nbsp;';
645
+
646
  // Parent
647
  echo
648
  __( 'Parent album', 'wp-photo-album-plus' ) . ':&nbsp;';
wppa-album-navigator-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display album names linking to content
6
- * Version 8.0.00.024
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
@@ -174,6 +174,13 @@ class AlbumNavigatorWidget extends WP_Widget {
174
  global $wpdb;
175
  static $level;
176
  static $ca;
 
 
 
 
 
 
 
177
 
178
  if ( ! $level ) {
179
  $level = '1';
@@ -200,7 +207,11 @@ class AlbumNavigatorWidget extends WP_Widget {
200
  $p = $parent;
201
  $result = '';
202
 
203
- $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %s ".$extraclause.wppa_get_album_order( max( '0', $parent ) ), $parent ), ARRAY_A );
 
 
 
 
204
 
205
  if ( ! empty( $albums ) ) {
206
  wppa_cache_album( 'add', $albums );
3
  * Package: wp-photo-album-plus
4
  *
5
  * display album names linking to content
6
+ * Version 8.0.04.004
7
  */
8
 
9
  class AlbumNavigatorWidget extends WP_Widget {
174
  global $wpdb;
175
  static $level;
176
  static $ca;
177
+ static $void;
178
+ static $void_looked_up;
179
+
180
+ if ( ! $void_looked_up ) {
181
+ $void = wppa_void_albums();
182
+ $void_looked_up = true;
183
+ }
184
 
185
  if ( ! $level ) {
186
  $level = '1';
207
  $p = $parent;
208
  $result = '';
209
 
210
+ $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
211
+ WHERE a_parent = %s " .
212
+ $void .
213
+ $extraclause .
214
+ wppa_get_album_order( max( '0', $parent ) ), $parent ), ARRAY_A );
215
 
216
  if ( ! empty( $albums ) ) {
217
  wppa_cache_album( 'add', $albums );
wppa-album-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
- * Version 8.0.02.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -30,6 +30,7 @@ class AlbumWidget extends WP_Widget {
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
  $cache = ! is_admin() && $instance['cache'];
32
  $cachefile = wppa_get_widget_cache_path( $this->id );
 
33
 
34
  // Logged in only and logged out?
35
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
@@ -58,7 +59,10 @@ class AlbumWidget extends WP_Widget {
58
  $albums = array();
59
  }
60
  else {
61
- $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums " . wppa_get_album_order(), ARRAY_A );
 
 
 
62
  }
63
  break;
64
  case 'last':
@@ -67,12 +71,16 @@ class AlbumWidget extends WP_Widget {
67
  }
68
  else {
69
  $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
 
 
70
  ORDER BY timestamp DESC", ARRAY_A );
71
  }
72
  break;
73
  default:
74
  $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
75
- WHERE a_parent = %d " . wppa_get_album_order( $parent ), $parent ), ARRAY_A );
 
 
76
  }
77
 
78
  // Add subalbums if required
@@ -87,11 +95,14 @@ class AlbumWidget extends WP_Widget {
87
 
88
  // Add (grand)childrens ids
89
  $ids = wppa_alb_to_enum_children( $ids );
90
- $ids = str_replace( '.', ',', $ids );
 
 
91
 
92
  // Do the new query
93
  $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
94
- WHERE id IN ( " . $ids . " ) " . wppa_get_album_order( $parent ) . "
 
95
  LIMIT %d", $max ), ARRAY_A );
96
  }
97
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail albums
6
+ * Version 8.0.04.004
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
30
  $widget_title = apply_filters( 'widget_title', $instance['title'] );
31
  $cache = ! is_admin() && $instance['cache'];
32
  $cachefile = wppa_get_widget_cache_path( $this->id );
33
+ $void = wppa_void_albums();
34
 
35
  // Logged in only and logged out?
36
  if ( wppa_checked( $instance['logonly'] ) && ! is_user_logged_in() ) {
59
  $albums = array();
60
  }
61
  else {
62
+ $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
63
+ WHERE id > 0 " .
64
+ $void .
65
+ wppa_get_album_order(), ARRAY_A );
66
  }
67
  break;
68
  case 'last':
71
  }
72
  else {
73
  $albums = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
74
+ WHERE id > 0 " .
75
+ $void . "
76
  ORDER BY timestamp DESC", ARRAY_A );
77
  }
78
  break;
79
  default:
80
  $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
81
+ WHERE a_parent = %d " .
82
+ $void .
83
+ wppa_get_album_order( $parent ), $parent ), ARRAY_A );
84
  }
85
 
86
  // Add subalbums if required
95
 
96
  // Add (grand)childrens ids
97
  $ids = wppa_alb_to_enum_children( $ids );
98
+ $ids_arr = explode( '.', $ids );
99
+ $ids_arr = array_diff( $ids_arr, wppa_get_void_aids() );
100
+ $ids = implode( ',', $ids_arr );
101
 
102
  // Do the new query
103
  $albums = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
104
+ WHERE id IN ( " . $ids . " ) " .
105
+ wppa_get_album_order( $parent ) . "
106
  LIMIT %d", $max ), ARRAY_A );
107
  }
108
 
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 8.0.03.003
7
  *
8
  */
9
 
@@ -3036,6 +3036,8 @@ static $albums_granted;
3036
  $alb = explode( '.', wppa_expand_enum( $alb ) );
3037
  }
3038
 
 
 
3039
  // Can an selection box be displayed?
3040
  if ( ! wppa_opt( 'fe_upload_max_albums' ) || // No limit on number of albums
3041
  wppa_opt( 'fe_upload_max_albums' ) > wppa_get_uploadable_album_count( $alb ) ) { // Below max
@@ -3094,7 +3096,7 @@ static $albums_granted;
3094
  $may_video = false;
3095
  $may_audio = false;
3096
  }
3097
-
3098
  if ( $one_only ) $max = '1';
3099
 
3100
  $accept = '.jpg,.gif,.png';
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
3036
  $alb = explode( '.', wppa_expand_enum( $alb ) );
3037
  }
3038
 
3039
+ $alb = wppa_strip_void( $alb );
3040
+
3041
  // Can an selection box be displayed?
3042
  if ( ! wppa_opt( 'fe_upload_max_albums' ) || // No limit on number of albums
3043
  wppa_opt( 'fe_upload_max_albums' ) > wppa_get_uploadable_album_count( $alb ) ) { // Below max
3096
  $may_video = false;
3097
  $may_audio = false;
3098
  }
3099
+
3100
  if ( $one_only ) $max = '1';
3101
 
3102
  $accept = '.jpg,.gif,.png';
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 8.0.02.008
6
  *
7
  */
8
 
@@ -1102,82 +1102,80 @@ global $wppa_session;
1102
  function wppa_clear_cache( $force = false ) {
1103
  global $cache_path;
1104
 
1105
- if ( ! wppa_is_cron() ) {
 
1106
 
1107
- // Clear wppa shortcode cache has priority
1108
- wppa_remove_shortcode_cache_path( '', true );
1109
 
1110
- // Clear wppa widget cache has priority
1111
- wppa_remove_widget_cache_path( '', true );
1112
 
1113
- // Log where it came from
1114
- /*
1115
- $data = debug_backtrace( DEBUG_BACKTRACE_IGNORE_ARGS, 6 );
1116
- $i = 1;
1117
- $stack =
1118
- ( isset( $data[$i]['file'] ) ? basename( $data[$i]['file'] ) . ':' : '' ) .
1119
- ( isset( $data[$i]['line'] ) ? $data[$i]['line'] . ' ' : '' ) .
1120
- ( isset( $data[$i]['function'] ) ? $data[$i]['function'] . '() ' : '' );
1121
- wppa_log( 'obs', '{b}WPPA cache{/b} cleared by ' . $stack );
1122
- */
1123
- }
1124
 
1125
- // Schedule a cron job. This is the normal operation
1126
- if ( ! $force && ! wppa_is_cron() ) {
1127
 
1128
- wppa_schedule_clear_cache();
1129
- return;
1130
- }
 
 
 
1131
 
1132
- // At activation, ($force = true) the entire cache must be cleared once.
 
 
 
 
1133
 
1134
- // If wp-super-cache is on board, clear cache
1135
- if ( function_exists( 'prune_super_cache' ) ) {
1136
- prune_super_cache( $cache_path . 'supercache/', true );
1137
- prune_super_cache( $cache_path, true );
1138
- wppa_log('obs', 'Super cache cleared');
1139
- }
 
 
1140
 
1141
- // W3 Total cache
1142
- if ( function_exists( 'w3tc_pgcache_flush' ) ) {
1143
- w3tc_pgcache_flush();
1144
- wppa_log('obs', 'w3tc pgcache cleared');
1145
- }
1146
 
1147
- // SG_CachePress
1148
- if ( class_exists( 'SG_CachePress_Supercacher' ) ) {
1149
- $c = new SG_CachePress_Supercacher();
1150
- if ( $c->purge_cache ) {
1151
- $c->purge_cache();
1152
- wppa_log('obs', 'SG CachePress Supercacher cache cleared');
1153
  }
1154
- }
1155
 
1156
- // Quick cache
1157
- if ( isset($GLOBALS['quick_cache']) ) {
1158
- $GLOBALS['quick_cache']->clear_cache();
1159
- wppa_log('obs', 'Quick cache cleared');
1160
- }
 
 
1161
 
1162
- // Comet cache
1163
- if ( class_exists( 'comet_cache' ) ) {
1164
- comet_cache::clear();
1165
- wppa_log('obs', 'Comet cache cleared');
1166
  }
1167
 
1168
- // Last resort: Manually remove the content of wp-content/cache/
1169
- if ( $force ) {
1170
- if ( wppa_is_dir( WPPA_CONTENT_PATH . '/cache/' ) ) {
1171
- wppa_tree_empty( WPPA_CONTENT_PATH . '/cache' );
1172
- wppa_log('obs', 'Generic cache cleared');
 
 
 
 
1173
  }
 
1174
  }
1175
-
1176
- // Remove tempfiles
1177
- // wppa_delete_obsolete_tempfiles( true );
1178
  }
1179
 
1180
- function wppa_remove_shortcode_cache_path( $file = '', $immediate = false ) {
1181
 
1182
  // Delete requested file
1183
  if ( $file ) {
@@ -1192,16 +1190,7 @@ function wppa_remove_shortcode_cache_path( $file = '', $immediate = false ) {
1192
 
1193
  $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
1194
  if ( wppa_is_dir( $root ) ) {
1195
-
1196
- $files = wppa_glob( $root . '/*' );
1197
- if ( $files ) {
1198
- $nfiles = count( $files );
1199
- foreach( $files as $file ) {
1200
- if ( $immediate || wppa_filetime( $file ) < ( 7 * 24 * 3600 ) ) {
1201
- wppa_unlink( $file );
1202
- }
1203
- }
1204
- }
1205
  }
1206
  }
1207
  }
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 8.0.04.004
6
  *
7
  */
8
 
1102
  function wppa_clear_cache( $force = false ) {
1103
  global $cache_path;
1104
 
1105
+ // Clear wppa shortcode cache has priority
1106
+ wppa_remove_shortcode_cache_path( '', true );
1107
 
1108
+ // Clear wppa widget cache has priority
1109
+ wppa_remove_widget_cache_path( '', true );
1110
 
1111
+ // Remove tempfiles
1112
+ wppa_delete_obsolete_tempfiles( true );
1113
 
1114
+ wppa_log( 'fso', 'WPPA cache cleared' );
 
 
 
 
 
 
 
 
 
 
1115
 
1116
+ // On init, clear all other caches using their apis
1117
+ if ( $force ) {
1118
 
1119
+ // If wp-super-cache is on board, clear cache
1120
+ if ( function_exists( 'prune_super_cache' ) ) {
1121
+ prune_super_cache( $cache_path . 'supercache/', true );
1122
+ prune_super_cache( $cache_path, true );
1123
+ wppa_log('obs', 'Super cache cleared');
1124
+ }
1125
 
1126
+ // W3 Total cache
1127
+ if ( function_exists( 'w3tc_pgcache_flush' ) ) {
1128
+ w3tc_pgcache_flush();
1129
+ wppa_log('obs', 'w3tc pgcache cleared');
1130
+ }
1131
 
1132
+ // SG_CachePress
1133
+ if ( class_exists( 'SG_CachePress_Supercacher' ) ) {
1134
+ $c = new SG_CachePress_Supercacher();
1135
+ if ( $c->purge_cache ) {
1136
+ $c->purge_cache();
1137
+ wppa_log('obs', 'SG CachePress Supercacher cache cleared');
1138
+ }
1139
+ }
1140
 
1141
+ // Quick cache
1142
+ if ( isset($GLOBALS['quick_cache']) ) {
1143
+ $GLOBALS['quick_cache']->clear_cache();
1144
+ wppa_log('obs', 'Quick cache cleared');
1145
+ }
1146
 
1147
+ // Comet cache
1148
+ if ( class_exists( 'comet_cache' ) ) {
1149
+ comet_cache::clear();
1150
+ wppa_log('obs', 'Comet cache cleared');
 
 
1151
  }
 
1152
 
1153
+ // Last resort: Manually remove the content of wp-content/cache/
1154
+ if ( $force ) {
1155
+ if ( wppa_is_dir( WPPA_CONTENT_PATH . '/cache/' ) ) {
1156
+ wppa_tree_empty( WPPA_CONTENT_PATH . '/cache' );
1157
+ wppa_log('obs', 'Generic cache cleared');
1158
+ }
1159
+ }
1160
 
1161
+ wppa_log( 'fso', 'NON-WPPA caches cleared' );
 
 
 
1162
  }
1163
 
1164
+ // Schedule a cron job for deleting any cache file that contains any wppa
1165
+ // If cron is doing this, do it immediately
1166
+ else {
1167
+
1168
+ if ( wppa_is_cron() ) {
1169
+ wppa_do_clear_cache();
1170
+ }
1171
+ else {
1172
+ wppa_schedule_clear_cache();
1173
  }
1174
+ return;
1175
  }
 
 
 
1176
  }
1177
 
1178
+ function wppa_remove_shortcode_cache_path( $file = '' ) {
1179
 
1180
  // Delete requested file
1181
  if ( $file ) {
1190
 
1191
  $root = WPPA_CONTENT_PATH . '/' . wppa_opt( 'cache_root' ) . '/wppa-shortcode';
1192
  if ( wppa_is_dir( $root ) ) {
1193
+ wppa_tree_empty( $root );
 
 
 
 
 
 
 
 
 
1194
  }
1195
  }
1196
  }
wppa-cron.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
- * Version 8.0.00.009
7
  *
8
  *
9
  */
@@ -386,41 +386,22 @@ global $wppa_endtime;
386
  add_action( 'wppa_clear_cache', 'wppa_do_clear_cache' );
387
 
388
  function wppa_schedule_clear_cache( $time = 10 ) {
389
- static $done;
390
 
391
  // Are we temp disbled?
392
  if ( wppa_switch( 'maint_ignore_cron' ) ) {
393
  return;
394
  }
395
 
396
- // If a cron job is scheduled cancel the request
397
- $next_scheduled = wp_next_scheduled( 'wppa_clear_cache' );
398
-
399
- if ( $next_scheduled ) {
400
- return;
401
- }
402
- /*
403
- if ( $time == 10 && is_numeric( $next_scheduled ) && $next_scheduled > ( time() + $time ) ) {
404
-
405
- wp_unschedule_event( $next_scheduled, 'wppa_clear_cache' );
406
- $did_unschedule = true;
407
- }
408
- else {
409
- $did_unschedule = false;
410
- }
411
- */
412
-
413
  // Schedule new event
414
- if ( ! wp_next_scheduled( 'wppa_clear_cache' ) && ! $done ) {
415
 
416
  wp_schedule_single_event( time() + $time, 'wppa_clear_cache' );
417
- $done = true;
418
 
419
  wppa_log( 'Cron', '{b}wppa_clear_cache{/b} scheduled for run in ' . $time . ' sec.' );
420
  }
421
  }
422
 
423
- // call the actusl cache deleting proc, and indicate only delete cache files with text 'data-wppa="yes"'
424
  function wppa_do_clear_cache() {
425
 
426
  $relroot = trim( wppa_opt( 'cache_root' ), '/' );
@@ -442,40 +423,35 @@ static $did_tempfiles;
442
  $fsos = wppa_glob( $dir . '/*' );
443
  if ( is_array( $fsos ) ) foreach ( $fsos as $fso ) {
444
 
445
- // If it is in ../wppa-widget/ or in ../wppa-shortcode/, wait until older than 2 hours
446
- $is_widget_cache = ( strpos( $fso, '/wppa-widget/' ) != false );
447
- $is_shortcode_cache = ( strpos( $fso, '/wppa-shortcode/' ) != false );
448
- if ( $is_widget_cache || $is_shortcode_cache ) {
449
- if ( wppa_filetime( $fso ) < ( time() - 24 * 3600 ) ) {
450
- unlink ( $fso );
451
- wppa_log( 'fso', 'Cron removed obsolete widget cachefile: {b}' . basename( $fso ) . '{/b}' );
452
  }
453
- }
454
- else {
455
- $name = basename( $fso );
456
- if ( $name != '.' && $name != '..' ) {
457
- if ( wppa_is_dir( $fso ) ) {
458
- _wppa_do_clear_cache( $fso );
459
- }
460
- else {
461
- $file = wppa_fopen( $fso, 'rb' );
462
- if ( $file ) {
463
- $size = filesize( $fso );
464
- if ( $size ) {
465
- $haystack = fread( $file, $size );
466
- if ( strpos( $haystack, $needle ) !== false ) {
467
- fclose( $file );
468
- unlink( $fso );
469
- wppa_log( 'fso', 'Cron removed cachefile: {b}' . str_replace( WPPA_CONTENT_PATH, '', $fso ) . '{/b}' );
470
- }
471
- else {
472
- fclose( $file );
473
- }
474
  }
475
  else {
476
  fclose( $file );
477
  }
478
  }
 
 
 
479
  }
480
  }
481
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all cron functions
6
+ * Version 8.0.04.004
7
  *
8
  *
9
  */
386
  add_action( 'wppa_clear_cache', 'wppa_do_clear_cache' );
387
 
388
  function wppa_schedule_clear_cache( $time = 10 ) {
 
389
 
390
  // Are we temp disbled?
391
  if ( wppa_switch( 'maint_ignore_cron' ) ) {
392
  return;
393
  }
394
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
395
  // Schedule new event
396
+ if ( ! wp_next_scheduled( 'wppa_clear_cache' ) ) {
397
 
398
  wp_schedule_single_event( time() + $time, 'wppa_clear_cache' );
 
399
 
400
  wppa_log( 'Cron', '{b}wppa_clear_cache{/b} scheduled for run in ' . $time . ' sec.' );
401
  }
402
  }
403
 
404
+ // call the actual cache deleting proc, and indicate only delete cache files with text 'data-wppa="yes"'
405
  function wppa_do_clear_cache() {
406
 
407
  $relroot = trim( wppa_opt( 'cache_root' ), '/' );
423
  $fsos = wppa_glob( $dir . '/*' );
424
  if ( is_array( $fsos ) ) foreach ( $fsos as $fso ) {
425
 
426
+ $name = basename( $fso );
427
+ if ( $name != '.' && $name != '..' ) {
428
+
429
+ // Is it a dir? go deeper
430
+ if ( wppa_is_dir( $fso ) ) {
431
+ _wppa_do_clear_cache( $fso );
 
432
  }
433
+
434
+ // It is a file
435
+ else {
436
+ $file = wppa_fopen( $fso, 'rb' );
437
+ if ( $file ) {
438
+ $size = filesize( $fso );
439
+ if ( $size ) {
440
+ $haystack = fread( $file, $size );
441
+
442
+ // Does it contain any wppa?
443
+ if ( strpos( $haystack, $needle ) !== false ) {
444
+ fclose( $file );
445
+ unlink( $fso );
446
+ wppa_log( 'fso', 'Cachefile: {b}' . str_replace( WPPA_CONTENT_PATH, '', $fso ) . '{/b} removed.' );
 
 
 
 
 
 
 
447
  }
448
  else {
449
  fclose( $file );
450
  }
451
  }
452
+ else {
453
+ fclose( $file );
454
+ }
455
  }
456
  }
457
  }
wppa-dashboard-widgets.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains dashboard widgets code
6
  *
7
- * Version 8.0.00.008
8
  *
9
  */
10
 
@@ -272,7 +272,17 @@ global $wpdb;
272
  // Recently uploaded photos
273
  echo '<h3>' . __( 'Recently uploaded photos', 'wp-photo-album-plus' ) . '</h3>';
274
 
275
- $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 5", ARRAY_A );
 
 
 
 
 
 
 
 
 
 
276
 
277
  if ( ! empty( $photos ) ) {
278
  echo
4
  *
5
  * Contains dashboard widgets code
6
  *
7
+ * Version 8.0.04.004
8
  *
9
  */
10
 
272
  // Recently uploaded photos
273
  echo '<h3>' . __( 'Recently uploaded photos', 'wp-photo-album-plus' ) . '</h3>';
274
 
275
+ $void = wppa_get_void_pids();
276
+ if ( count ( $void ) ) {
277
+ $void_clause = " WHERE id NOT IN (" . implode( ',', $void ) . ") ";
278
+ }
279
+ else {
280
+ $void_clause = "";
281
+ }
282
+
283
+ $photos = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos " .
284
+ $void_clause . "
285
+ ORDER BY timestamp DESC LIMIT 5", ARRAY_A );
286
 
287
  if ( ! empty( $photos ) ) {
288
  echo
wppa-featen-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the featured photos
6
- * Version 8.0.02.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -55,7 +55,10 @@ class FeaTenWidget extends WP_Widget {
55
 
56
  // Owner/public
57
  case '-3':
58
- $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE status = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
 
 
 
59
  if ( $temp ) {
60
  $c = '0';
61
  $thumbs = array();
@@ -75,7 +78,10 @@ class FeaTenWidget extends WP_Widget {
75
 
76
  // Generic
77
  case '-2':
78
- $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE status = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
 
 
 
79
  if ( $temp ) {
80
  $c = '0';
81
  $thumbs = array();
@@ -94,12 +100,20 @@ class FeaTenWidget extends WP_Widget {
94
 
95
  // All
96
  case '0':
97
- $thumbs = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos WHERE status = 'featured' ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A );
 
 
 
98
  break;
99
 
100
  // Album spec
101
  default:
102
- $thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status= 'featured' AND album = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album ), ARRAY_A );
 
 
 
 
 
103
  }
104
 
105
  $widget_content = "\n".'<!-- WPPA+ FeaTen Widget start -->';
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the featured photos
6
+ * Version 8.0.04.004
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
55
 
56
  // Owner/public
57
  case '-3':
58
+ $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
59
+ WHERE status = 'featured' " .
60
+ wppa_void_albums( 'photos' ) . "
61
+ ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
62
  if ( $temp ) {
63
  $c = '0';
64
  $thumbs = array();
78
 
79
  // Generic
80
  case '-2':
81
+ $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
82
+ WHERE status = 'featured' " .
83
+ wppa_void_albums( 'photos' ) . "
84
+ ORDER BY RAND(" . wppa_get_randseed() . ") DESC", ARRAY_A );
85
  if ( $temp ) {
86
  $c = '0';
87
  $thumbs = array();
100
 
101
  // All
102
  case '0':
103
+ $thumbs = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_photos
104
+ WHERE status = 'featured' " .
105
+ wppa_void_albums( 'photos' ) . "
106
+ ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, ARRAY_A );
107
  break;
108
 
109
  // Album spec
110
  default:
111
+ if ( ! in_array( $album, wppa_get_void_pids() ) ) {
112
+ $thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status= 'featured' AND album = %s ORDER BY RAND(" . wppa_get_randseed() . ") DESC LIMIT " . $max, $album ), ARRAY_A );
113
+ }
114
+ else {
115
+ $thumbs = array();
116
+ }
117
  }
118
 
119
  $widget_content = "\n".'<!-- WPPA+ FeaTen Widget start -->';
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 8.0.04.003
7
  *
8
  */
9
 
@@ -959,13 +959,19 @@ global $wppa_current_shortcode_atts;
959
  }
960
  else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
961
  global $wppa_version;
962
- $expected_version = '8.0.04.003';
963
  if ( $wppa_version != $expected_version ) {
964
  wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
965
  }
966
  }
967
 
968
  // Done
 
 
 
 
 
 
969
  $out = str_replace( 'w#location', wppa( 'geo' ), wppa( 'out' ) );
970
 
971
  // Cache?
@@ -1071,18 +1077,6 @@ function wppa_get_albums() {
1071
  global $wpdb;
1072
  global $wppa_session;
1073
 
1074
- wppa_dbg_msg( 'get_albums entered: ' . wppa( 'mocc' ) . ' Start_album=' . wppa( 'start_album' ) . ', Cover=' . wppa( 'is_cover' ) );
1075
-
1076
- /* Check encryption
1077
- if ( wppa( 'start_album' ) ) {
1078
- $t = wppa_decrypt_album( wppa( 'start_album' ), true, true );
1079
- if ( $t != wppa( 'start_album' ) ) {
1080
- wppa_log( 'err', 'Encrypted album id founc in wppa_get_albums() ' . wppa( 'start_album' ) . ' jit fixed', true );
1081
- wppa( 'start_album', $t );
1082
- }
1083
- }
1084
- */
1085
-
1086
  if ( wppa( 'is_topten' ) ) return false;
1087
  if ( wppa( 'is_lasten' ) ) return false;
1088
  if ( wppa( 'is_comten' ) ) return false;
@@ -1240,11 +1234,14 @@ global $wppa_session;
1240
  if ( wppa( 'last_albums_parent' ) ) {
1241
  $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1242
  WHERE a_parent = %s
 
1243
  ORDER BY timestamp DESC
1244
  LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
1245
  }
1246
  else {
1247
  $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
 
 
1248
  ORDER BY timestamp DESC
1249
  LIMIT %d", wppa( 'last_albums' ) );
1250
  }
@@ -1289,6 +1286,9 @@ global $wppa_session;
1289
  }
1290
  }
1291
 
 
 
 
1292
  // Copy data into secondary cache
1293
  if ( $albums ) {
1294
  wppa_cache_album( 'add', $albums );
@@ -1337,16 +1337,6 @@ global $wppa_session;
1337
  // Make Album clause if album given
1338
  if ( wppa( 'start_album' ) ) {
1339
 
1340
- /* Check encryption
1341
- if ( wppa( 'start_album' ) ) {
1342
- $t = wppa_decrypt_album( wppa( 'start_album' ), true, true );
1343
- if ( $t != wppa( 'start_album' ) ) {
1344
- wppa_log( 'err', 'Encrypted album id founc in wppa_get_thumbs() ' . wppa( 'start_album' ) . ' jit fixed', true );
1345
- wppa( 'start_album', $t );
1346
- }
1347
- }
1348
- */
1349
-
1350
  // See if album is an enumeration or range
1351
  $fullalb = wppa( 'start_album' );
1352
 
@@ -1358,6 +1348,7 @@ global $wppa_session;
1358
  // Enum albums
1359
  else {
1360
  $ids = wppa_series_to_array( $fullalb );
 
1361
  $album_clause = " album IN ( " . implode( ',', $ids ) . " ) ";
1362
  }
1363
  }
@@ -1365,7 +1356,7 @@ global $wppa_session;
1365
  // No album given, make sure trashed photos are not found
1366
  else {
1367
  $fullalb = '';
1368
- $album_clause = " album > '0' ";
1369
  }
1370
 
1371
  // For upload link on thumbarea: if startalbum is a single real album, put it in current album
@@ -1381,14 +1372,6 @@ global $wppa_session;
1381
  // Single image slideshow?
1382
  if ( wppa( 'start_photo' ) && wppa( 'is_single' ) ) {
1383
 
1384
- /* Check encryption
1385
- $t = wppa_decrypt_photo( wppa( 'start_photo' ), true, true );
1386
- if ( $t != wppa( 'start_photo' ) ) {
1387
- wppa_log( 'err', 'Encrypted photo id founc in wppa_get_thumbs() ' . wppa( 'start_album' ) . ' jit fixed' );
1388
- wppa( 'start_photo', $t );
1389
- }
1390
- */
1391
-
1392
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1393
  WHERE id = %s", wppa( 'start_photo' ) );
1394
  }
@@ -2294,6 +2277,9 @@ global $wpdb;
2294
  wppa_log( 'war', 'Long query: ' . strlen($query) . ' chars. ' . substr( htmlspecialchars( $query ), 0, 100 ) . '...' , true );
2295
  }
2296
 
 
 
 
2297
  // Process extended duplicate removal
2298
  if ( $exduprem ) {
2299
  wppa_extended_duplicate_remove( $thumbs );
@@ -2315,6 +2301,97 @@ global $wpdb;
2315
  return $thumbs;
2316
  }
2317
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2318
  // Remove duplicates where name, description and display files are identical
2319
  function wppa_extended_duplicate_remove( &$thumbs ) {
2320
 
@@ -5950,7 +6027,7 @@ global $wppa_lang;
5950
  if ( ! wppa_is_dir ( $root ) ) {
5951
  wppa_mktree( $root );
5952
  }
5953
- $cache_file = $root . '/' . $wppa_lang . '-' . ( is_user_logged_in() ? 'login-' : '' ) . ( wppa_is_mobile() ? 'mobile-' : '' ) . $cache_id;
5954
 
5955
  // Cachefile present?
5956
  if ( wppa_is_file( $cache_file ) ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
959
  }
960
  else wppa_out( '<span style="color:red">ERROR: Missing function wppa_theme(), check the installation of WPPA+. Remove customized wppa_theme.php</span>' );
961
  global $wppa_version;
962
+ $expected_version = '8.0.04.004';
963
  if ( $wppa_version != $expected_version ) {
964
  wppa_dbg_msg( 'WARNING: customized wppa-theme.php is out of rev. Expected version: ' . $expected_version . ' found: ' . $wppa_version, 'red' );
965
  }
966
  }
967
 
968
  // Done
969
+ global $wppa_empty_content;
970
+ if ( $wppa_empty_content && ! wppa( 'src' ) ) {
971
+ wppa_reset_occurrance();
972
+ $wppa_empty_content = false;
973
+ return '';
974
+ }
975
  $out = str_replace( 'w#location', wppa( 'geo' ), wppa( 'out' ) );
976
 
977
  // Cache?
1077
  global $wpdb;
1078
  global $wppa_session;
1079
 
 
 
 
 
 
 
 
 
 
 
 
 
1080
  if ( wppa( 'is_topten' ) ) return false;
1081
  if ( wppa( 'is_lasten' ) ) return false;
1082
  if ( wppa( 'is_comten' ) ) return false;
1234
  if ( wppa( 'last_albums_parent' ) ) {
1235
  $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1236
  WHERE a_parent = %s
1237
+ " . wppa_void_albums() . "
1238
  ORDER BY timestamp DESC
1239
  LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
1240
  }
1241
  else {
1242
  $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1243
+ WHERE id > 0
1244
+ " . wppa_void_albums() . "
1245
  ORDER BY timestamp DESC
1246
  LIMIT %d", wppa( 'last_albums' ) );
1247
  }
1286
  }
1287
  }
1288
 
1289
+ // Check for album status
1290
+ $albums = wppa_remove_album_status( $albums );
1291
+
1292
  // Copy data into secondary cache
1293
  if ( $albums ) {
1294
  wppa_cache_album( 'add', $albums );
1337
  // Make Album clause if album given
1338
  if ( wppa( 'start_album' ) ) {
1339
 
 
 
 
 
 
 
 
 
 
 
1340
  // See if album is an enumeration or range
1341
  $fullalb = wppa( 'start_album' );
1342
 
1348
  // Enum albums
1349
  else {
1350
  $ids = wppa_series_to_array( $fullalb );
1351
+ $ids = wppa_strip_void( $ids );
1352
  $album_clause = " album IN ( " . implode( ',', $ids ) . " ) ";
1353
  }
1354
  }
1356
  // No album given, make sure trashed photos are not found
1357
  else {
1358
  $fullalb = '';
1359
+ $album_clause = " album > '0' " . wppa_void_albums( 'photos' );
1360
  }
1361
 
1362
  // For upload link on thumbarea: if startalbum is a single real album, put it in current album
1372
  // Single image slideshow?
1373
  if ( wppa( 'start_photo' ) && wppa( 'is_single' ) ) {
1374
 
 
 
 
 
 
 
 
 
1375
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1376
  WHERE id = %s", wppa( 'start_photo' ) );
1377
  }
2277
  wppa_log( 'war', 'Long query: ' . strlen($query) . ' chars. ' . substr( htmlspecialchars( $query ), 0, 100 ) . '...' , true );
2278
  }
2279
 
2280
+ // Remove items because of status album
2281
+ $thumbs = wppa_remove_album_status( $thumbs, 'photos' );
2282
+
2283
  // Process extended duplicate removal
2284
  if ( $exduprem ) {
2285
  wppa_extended_duplicate_remove( $thumbs );
2301
  return $thumbs;
2302
  }
2303
 
2304
+ // Remove items because of status album
2305
+ function wppa_remove_album_status( $items, $what = 'albums' ) {
2306
+ global $wpdb;
2307
+
2308
+ // Find voided albums
2309
+ $void_albs = array();
2310
+ if ( ! wppa_user_is( 'administrator' ) ) {
2311
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
2312
+ }
2313
+ if ( ! is_user_logged_in() ) {
2314
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
2315
+ }
2316
+
2317
+ // Nothing found? return original
2318
+ if ( ! count( $void_albs ) ) {
2319
+ return $items;
2320
+ }
2321
+
2322
+ // Remove albums
2323
+ if ( $what == 'albums' ) {
2324
+ foreach ( array_keys( $items ) as $key ) {
2325
+ if ( in_array( $items[$key]['id'], $void_albs ) ) {
2326
+ unset( $items[$key] );
2327
+ }
2328
+ }
2329
+ }
2330
+
2331
+ // Remove photos
2332
+ else {
2333
+ foreach ( array_keys( $items ) as $key ) {
2334
+ if ( in_array( $items[$key]['album'], $void_albs ) ) {
2335
+ unset( $items[$key] );
2336
+ }
2337
+ }
2338
+ }
2339
+
2340
+ // Done, return stripped data
2341
+ return $items;
2342
+ }
2343
+
2344
+ // Strip void albums from array
2345
+ function wppa_strip_void( $albarr ) {
2346
+ global $wpdb;
2347
+
2348
+ // Find voided albums
2349
+ $void_albs = array();
2350
+ if ( ! wppa_user_is( 'administrator' ) ) {
2351
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
2352
+ }
2353
+ if ( ! is_user_logged_in() ) {
2354
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
2355
+ }
2356
+
2357
+ $result = array_diff( $albarr, $void_albs );
2358
+ return $result;
2359
+ }
2360
+
2361
+ // Get the void albums clause for queries
2362
+ function wppa_void_albums( $for = 'albums' ) {
2363
+ global $wpdb;
2364
+
2365
+ // Find voided albums
2366
+ $void_albs = array();
2367
+ if ( ! wppa_user_is( 'administrator' ) ) {
2368
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
2369
+ }
2370
+ if ( ! is_user_logged_in() ) {
2371
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
2372
+ }
2373
+
2374
+ // Anything found
2375
+ if ( count ( $void_albs ) ) {
2376
+
2377
+ // For albums
2378
+ if ( $for == 'albums' ) {
2379
+ $result = " AND id NOT IN (" . implode ( ",", $void_albs ) . ") ";
2380
+ }
2381
+
2382
+ // For photos
2383
+ else {
2384
+ $result = " AND album NOT IN (" . implode ( ",", $void_albs ) . ") ";
2385
+ }
2386
+
2387
+ }
2388
+ else {
2389
+ $result = "";
2390
+ }
2391
+
2392
+ return $result;
2393
+ }
2394
+
2395
  // Remove duplicates where name, description and display files are identical
2396
  function wppa_extended_duplicate_remove( &$thumbs ) {
2397
 
6027
  if ( ! wppa_is_dir ( $root ) ) {
6028
  wppa_mktree( $root );
6029
  }
6030
+ $cache_file = $root . '/' . $wppa_lang . '-' . ( is_user_logged_in() ? 'login-' : '' ) . ( wppa_user_is( 'administrator' ) ? 'admin-' : '' ) . ( wppa_is_mobile() ? 'mobile-' : '' ) . $cache_id;
6031
 
6032
  // Cachefile present?
6033
  if ( wppa_is_file( $cache_file ) ) {
wppa-init.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
- * Version 8.0.03.003
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
@@ -365,7 +365,7 @@ global $wpdb;
365
  // Check upload logout for moderate
366
  function wppa_check_upload_logout() {
367
 
368
- if ( wppa_switch( 'upload_logout' ) && ! wppa_switch( 'upload_moderate' ) ) {
369
  $text = __( 'Warning: Non logged in users can upload photos while uploads do not need to be moderated. This can lead to unwanted content on this website!', 'wp-photo-album-plus' ) .
370
  '<br />' . wppa_see_also( 'users', '1', '32' ) . ' ' . __( 'and', 'wp-photo-album-plus' ) . ' ' . wppa_see_also( 'admin', '2', '11' );
371
  wppa_warning_message( $text );
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
+ * Version 8.0.04.004
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
365
  // Check upload logout for moderate
366
  function wppa_check_upload_logout() {
367
 
368
+ if ( wppa_switch( 'upload_logout' ) && ! wppa_switch( 'upload_moderate' ) && wppa_user_is( 'administrator' ) ) {
369
  $text = __( 'Warning: Non logged in users can upload photos while uploads do not need to be moderated. This can lead to unwanted content on this website!', 'wp-photo-album-plus' ) .
370
  '<br />' . wppa_see_also( 'users', '1', '32' ) . ' ' . __( 'and', 'wp-photo-album-plus' ) . ' ' . wppa_see_also( 'admin', '2', '11' );
371
  wppa_warning_message( $text );
wppa-lasten-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the last uploaded photos
6
- * Version 8.0.02.006
7
  */
8
 
9
  class LasTenWidget extends WP_Widget {
@@ -82,6 +82,9 @@ class LasTenWidget extends WP_Widget {
82
  break;
83
  }
84
  $album = trim( $album, ',' );
 
 
 
85
 
86
  // Eiter look at timestamp or at date/time modified
87
  $order_by = wppa_switch( 'lasten_use_modified' ) ? 'modified' : 'timestamp';
@@ -89,6 +92,9 @@ class LasTenWidget extends WP_Widget {
89
  // Non private
90
  $non_private = is_user_logged_in() ? "" : "AND status <> 'private' ";
91
 
 
 
 
92
  // If you want only 'New' photos in the selection, the period must be <> 0;
93
  if ( wppa_switch( 'lasten_limit_new' ) && wppa_opt( 'max_photo_newtime' ) ) {
94
  $newtime = " " . $order_by . " >= ".( time() - wppa_opt( 'max_photo_newtime' ) );
@@ -99,6 +105,7 @@ class LasTenWidget extends WP_Widget {
99
  AND status <> 'pending'
100
  AND status <> 'scheduled'
101
  $non_private
 
102
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
103
  }
104
  else {
@@ -107,7 +114,9 @@ class LasTenWidget extends WP_Widget {
107
  AND album > 0
108
  AND status <> 'pending'
109
  AND status <> 'scheduled'
 
110
  $non_private
 
111
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
112
  }
113
  }
@@ -118,6 +127,7 @@ class LasTenWidget extends WP_Widget {
118
  AND status <> 'pending'
119
  AND status <> 'scheduled'
120
  $non_private
 
121
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
122
  }
123
  else {
@@ -126,6 +136,7 @@ class LasTenWidget extends WP_Widget {
126
  AND status <> 'pending'
127
  AND status <> 'scheduled'
128
  $non_private
 
129
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
130
  }
131
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the last uploaded photos
6
+ * Version 8.0.04.004
7
  */
8
 
9
  class LasTenWidget extends WP_Widget {
82
  break;
83
  }
84
  $album = trim( $album, ',' );
85
+ $album_arr = explode( ',', $album );
86
+ $album_arr = array_diff( $album_arr, wppa_get_void_aids() );
87
+ $album = implode( ',', $album_arr );
88
 
89
  // Eiter look at timestamp or at date/time modified
90
  $order_by = wppa_switch( 'lasten_use_modified' ) ? 'modified' : 'timestamp';
92
  // Non private
93
  $non_private = is_user_logged_in() ? "" : "AND status <> 'private' ";
94
 
95
+ // Non void
96
+ $non_void = wppa_void_albums( 'photos' );
97
+
98
  // If you want only 'New' photos in the selection, the period must be <> 0;
99
  if ( wppa_switch( 'lasten_limit_new' ) && wppa_opt( 'max_photo_newtime' ) ) {
100
  $newtime = " " . $order_by . " >= ".( time() - wppa_opt( 'max_photo_newtime' ) );
105
  AND status <> 'pending'
106
  AND status <> 'scheduled'
107
  $non_private
108
+ $non_void
109
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
110
  }
111
  else {
114
  AND album > 0
115
  AND status <> 'pending'
116
  AND status <> 'scheduled'
117
+ wppa_album_void( 'photos')
118
  $non_private
119
+ $non_void
120
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
121
  }
122
  }
127
  AND status <> 'pending'
128
  AND status <> 'scheduled'
129
  $non_private
130
+ $non_void
131
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
132
  }
133
  else {
136
  AND status <> 'pending'
137
  AND status <> 'scheduled'
138
  $non_private
139
+ $non_void
140
  ORDER BY " . $order_by . " DESC LIMIT " . $max;
141
  }
142
  }
wppa-mailing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains mailing functions
6
  *
7
- * Version 8.0.00.008
8
  *
9
  */
10
 
@@ -916,7 +916,18 @@ function wppa_unsubscribe_link( $user_id, $listtype ) {
916
 
917
  $user = get_user_by( 'ID', $user_id );
918
  $crypt = crypt( $listtype . $user->ID . $user->login_name, $user->display_name );
919
- $url = site_url() . 'wppaajax/'; //admin_url( 'admin-ajax.php' );
 
 
 
 
 
 
 
 
 
 
 
920
  $url .= '?action=wppa&wppa-action=mailinglist&list=' . $listtype . '&onoff=off&user=' . $user_id . '&crypt=' . $crypt;
921
 
922
  $link = '<a href="' . $url . '" >';
4
  *
5
  * Contains mailing functions
6
  *
7
+ * Version 8.0.04.004
8
  *
9
  */
10
 
916
 
917
  $user = get_user_by( 'ID', $user_id );
918
  $crypt = crypt( $listtype . $user->ID . $user->login_name, $user->display_name );
919
+
920
+ switch ( wppa_opt( 'ajax_method' ) ) {
921
+ case 'admin':
922
+ $url = site_url() . '/wp-admin/admin-ajax.php';
923
+ break;
924
+ case 'extern':
925
+ $url = WPPA_URL . '/wppa-ajax-front.php';
926
+ break;
927
+ default:
928
+ $url = site_url() . '/wppaajax';
929
+ break;
930
+ }
931
  $url .= '?action=wppa&wppa-action=mailinglist&list=' . $listtype . '&onoff=off&user=' . $user_id . '&crypt=' . $crypt;
932
 
933
  $link = '<a href="' . $url . '" >';
wppa-maintenance.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
- * Version 8.0.03.006
7
  *
8
  */
9
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains (not yet, but in the future maybe) all the maintenance routines
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
wppa-potd-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the photo of the day widget
6
- * Version 8.0.00.024
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -217,11 +217,13 @@ class PhotoOfTheDay extends WP_Widget {
217
  }
218
  $result .= $widget_content . $after_widget;
219
 
220
- echo wppa_compress_html( $result );
 
 
221
  echo wppa_widget_timer( 'show', $widget_title );
222
 
223
  // Cache?
224
- if ( $cache ) {
225
  wppa_put_contents( $cachefile, $result );
226
  }
227
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the photo of the day widget
6
+ * Version 8.0.04.004
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
217
  }
218
  $result .= $widget_content . $after_widget;
219
 
220
+ if ( $image ) {
221
+ echo wppa_compress_html( $result );
222
+ }
223
  echo wppa_widget_timer( 'show', $widget_title );
224
 
225
  // Cache?
226
+ if ( $image && $cache ) {
227
  wppa_put_contents( $cachefile, $result );
228
  }
229
 
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 8.0.00.021
7
  *
8
  */
9
 
@@ -74,6 +74,7 @@ global $wppa_error;
74
  displayopts tinytext NOT NULL,
75
  upload_limit_tree tinytext NOT NULL,
76
  scheduledel tinytext NOT NULL,
 
77
  PRIMARY KEY (id)
78
  ) DEFAULT CHARACTER SET utf8;";
79
 
@@ -276,6 +277,10 @@ global $wppa_error;
276
  update_option( 'wppa_lazy', 'all' );
277
  }
278
  }
 
 
 
 
279
  }
280
 
281
  // Check required directories
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
74
  displayopts tinytext NOT NULL,
75
  upload_limit_tree tinytext NOT NULL,
76
  scheduledel tinytext NOT NULL,
77
+ status tinytext NOT NULL,
78
  PRIMARY KEY (id)
79
  ) DEFAULT CHARACTER SET utf8;";
80
 
277
  update_option( 'wppa_lazy', 'all' );
278
  }
279
  }
280
+
281
+ if ( $old_rev <= '8004004' ) {
282
+ $wpdb->query( "UPDATE $wpdb->wppa_albums SET status = 'publish' WHERE status = ''" );
283
+ }
284
  }
285
 
286
  // Check required directories
wppa-slideshow-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a slideshow in the sidebar
6
- * Version 8.0.02.006
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -92,19 +92,30 @@ class SlideshowWidget extends WP_Widget {
92
  if ( $album > '0' && wppa_checked( $instance['incsubs'] ) ) {
93
  $album = wppa_alb_to_enum_children( $album );
94
  }
 
95
 
96
- // Open the slideshow container
97
- $widget_content .=
98
- '<div' .
99
- ' style="padding-top:2px; padding-bottom:4px;" ' .
100
- ' data-wppa="yes" >';
101
 
102
- // The very slideshow
103
- $widget_content .= wppa_albums( $album, 'slideonly', $instance['width'], 'center' );
 
 
 
 
 
 
104
 
105
- // Close slideshw container
106
- $widget_content .=
107
- '</div>';
 
 
 
 
 
 
 
 
108
 
109
  // Reset runtime parameters
110
  wppa_reset_occurrance();
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a slideshow in the sidebar
6
+ * Version 8.0.04.004
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
92
  if ( $album > '0' && wppa_checked( $instance['incsubs'] ) ) {
93
  $album = wppa_alb_to_enum_children( $album );
94
  }
95
+ $album = implode( '.', wppa_strip_void( explode( '.', $album ) ) );
96
 
97
+ if ( $album ) {
 
 
 
 
98
 
99
+ // Open the slideshow container
100
+ $widget_content .=
101
+ '<div' .
102
+ ' style="padding-top:2px; padding-bottom:4px;" ' .
103
+ ' data-wppa="yes" >';
104
+
105
+ // The very slideshow
106
+ $widget_content .= wppa_albums( $album, 'slideonly', $instance['width'], 'center' );
107
 
108
+ // Close slideshw container
109
+ $widget_content .=
110
+ '</div>';
111
+ }
112
+ else {
113
+
114
+ // Nothing left after stripping. quit
115
+ wppa_reset_occurrance();
116
+ wppa( 'in_widget', false );
117
+ return;
118
+ }
119
 
120
  // Reset runtime parameters
121
  wppa_reset_occurrance();
wppa-topten-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
- * Version 8.0.00.024
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
@@ -125,6 +125,8 @@ class TopTenWidget extends WP_Widget {
125
  $album = str_replace( '.', ',', $albenum );
126
  }
127
 
 
 
128
  // Doit
129
  if ( $medalsonly ) {
130
  switch ( $instance['sortby'] ) {
@@ -207,6 +209,9 @@ class TopTenWidget extends WP_Widget {
207
 
208
  // No album specified
209
  else {
 
 
 
210
  if ( $medalsonly ) {
211
  switch ( $instance['sortby'] ) {
212
 
@@ -215,6 +220,7 @@ class TopTenWidget extends WP_Widget {
215
  WHERE album > 0
216
  AND status IN ( 'gold', 'silver', 'bronze' )
217
  $non_zero
 
218
  ORDER BY rating_count DESC, mean_rating DESC, views DESC
219
  LIMIT %d";
220
  break;
@@ -224,6 +230,7 @@ class TopTenWidget extends WP_Widget {
224
  WHERE album > 0
225
  AND status IN ( 'gold', 'silver', 'bronze' )
226
  $non_zero
 
227
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
228
  LIMIT %d";
229
  break;
@@ -233,6 +240,7 @@ class TopTenWidget extends WP_Widget {
233
  WHERE album > 0
234
  AND status IN ( 'gold', 'silver', 'bronze' )
235
  $non_zero
 
236
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
237
  LIMIT %d";
238
  break;
@@ -243,6 +251,7 @@ class TopTenWidget extends WP_Widget {
243
  WHERE album > 0
244
  AND status IN ( 'gold', 'silver', 'bronze' )
245
  $non_zero
 
246
  ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
247
  LIMIT %d";
248
  break;
@@ -258,6 +267,7 @@ class TopTenWidget extends WP_Widget {
258
  WHERE album > 0
259
  $non_zero
260
  $non_private
 
261
  ORDER BY rating_count DESC, mean_rating DESC, views DESC
262
  LIMIT %d";
263
  break;
@@ -267,6 +277,7 @@ class TopTenWidget extends WP_Widget {
267
  WHERE album > 0
268
  $non_zero
269
  $non_private
 
270
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
271
  LIMIT %d";
272
  break;
@@ -276,6 +287,7 @@ class TopTenWidget extends WP_Widget {
276
  WHERE album > 0
277
  $non_zero
278
  $non_private
 
279
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
280
  LIMIT %d";
281
  break;
@@ -286,6 +298,7 @@ class TopTenWidget extends WP_Widget {
286
  WHERE album > 0
287
  $non_zero
288
  $non_private
 
289
  ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
290
  LIMIT %d";
291
  break;
3
  * Package: wp-photo-album-plus
4
  *
5
  * display the top rated photos
6
+ * Version 8.0.04.004
7
  */
8
 
9
  class TopTenWidget extends WP_Widget {
125
  $album = str_replace( '.', ',', $albenum );
126
  }
127
 
128
+ $albums = implode( ',', array_diff( explode( ',', $albums ), wppa_get_void_aids() ) );
129
+
130
  // Doit
131
  if ( $medalsonly ) {
132
  switch ( $instance['sortby'] ) {
209
 
210
  // No album specified
211
  else {
212
+
213
+ $non_void = wppa_void_albums( 'photos' );
214
+
215
  if ( $medalsonly ) {
216
  switch ( $instance['sortby'] ) {
217
 
220
  WHERE album > 0
221
  AND status IN ( 'gold', 'silver', 'bronze' )
222
  $non_zero
223
+ $non_void
224
  ORDER BY rating_count DESC, mean_rating DESC, views DESC
225
  LIMIT %d";
226
  break;
230
  WHERE album > 0
231
  AND status IN ( 'gold', 'silver', 'bronze' )
232
  $non_zero
233
+ $non_void
234
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
235
  LIMIT %d";
236
  break;
240
  WHERE album > 0
241
  AND status IN ( 'gold', 'silver', 'bronze' )
242
  $non_zero
243
+ $non_void
244
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
245
  LIMIT %d";
246
  break;
251
  WHERE album > 0
252
  AND status IN ( 'gold', 'silver', 'bronze' )
253
  $non_zero
254
+ $non_void
255
  ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
256
  LIMIT %d";
257
  break;
267
  WHERE album > 0
268
  $non_zero
269
  $non_private
270
+ $non_void
271
  ORDER BY rating_count DESC, mean_rating DESC, views DESC
272
  LIMIT %d";
273
  break;
277
  WHERE album > 0
278
  $non_zero
279
  $non_private
280
+ $non_void
281
  ORDER BY views DESC, mean_rating DESC, rating_count DESC
282
  LIMIT %d";
283
  break;
287
  WHERE album > 0
288
  $non_zero
289
  $non_private
290
+ $non_void
291
  ORDER BY mean_rating DESC, rating_count DESC, views DESC
292
  LIMIT %d";
293
  break;
298
  WHERE album > 0
299
  $non_zero
300
  $non_private
301
+ $non_void
302
  ORDER BY dlcount DESC, mean_rating DESC, rating_count DESC, views DESC
303
  LIMIT %d";
304
  break;
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 8.0.03.004
7
  *
8
  */
9
 
@@ -2335,10 +2335,18 @@ global $wpdb;
2335
 
2336
  // Phase 2, get the ratings of the period
2337
  // find $ratings, ordered by photo id
 
 
 
 
 
 
 
2338
  $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
2339
  WHERE timestamp >= %s
2340
- AND timestamp < %s
2341
- ORDER BY photo", $start, $end ), ARRAY_A );
 
2342
 
2343
  // Phase 3, set up an array with data we need
2344
  // There are two methods: photo oriented and owner oriented, depending on
@@ -2884,30 +2892,69 @@ function wppa_browser_can_html5() {
2884
  function wppa_get_comten_ids( $max_count = 0, $albums = array() ) {
2885
  global $wpdb;
2886
 
 
2887
  if ( ! $max_count ) {
2888
  $max_count = wppa_opt( 'comten_count' );
2889
  }
2890
 
2891
- $photo_ids = $wpdb->get_results( $wpdb->prepare( "SELECT photo FROM $wpdb->wppa_comments
2892
- WHERE status = 'approved'
2893
- ORDER BY timestamp DESC LIMIT %d", 100 * $max_count ), ARRAY_A );
 
 
2894
  $result = array();
2895
 
 
2896
  if ( is_array( $photo_ids ) ) {
2897
  foreach( $photo_ids as $ph ) {
2898
- if ( empty( $albums ) || in_array( wppa_get_photo_item( $ph['photo'], 'album' ), $albums ) || ( count( $albums ) == 1 && $albums[0] == '0' ) ) {
2899
- if ( count( $result ) < $max_count ) {
2900
- if ( ! in_array( $ph['photo'], $result ) ) {
2901
- $result[] = $ph['photo'];
2902
- }
2903
  }
2904
  }
2905
  }
2906
  }
2907
 
 
 
 
 
 
 
 
 
2908
  return $result;
2909
  }
2910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2911
  // Retrieve a get-vareiable, sanitized and post-processed
2912
  // Return '1' if set without value, return false when value is 'nil'
2913
  function wppa_get_get( $index ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
2335
 
2336
  // Phase 2, get the ratings of the period
2337
  // find $ratings, ordered by photo id
2338
+ $void = wppa_get_void_pids();
2339
+ if ( count ( $void ) ) {
2340
+ $void_clause = " AND photo NOT IN (" . implode( ',', $void ) . ") ";
2341
+ }
2342
+ else {
2343
+ $void_clause = "";
2344
+ }
2345
  $ratings = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
2346
  WHERE timestamp >= %s
2347
+ AND timestamp < %s" .
2348
+ $void_clause .
2349
+ "ORDER BY photo", $start, $end ), ARRAY_A );
2350
 
2351
  // Phase 3, set up an array with data we need
2352
  // There are two methods: photo oriented and owner oriented, depending on
2892
  function wppa_get_comten_ids( $max_count = 0, $albums = array() ) {
2893
  global $wpdb;
2894
 
2895
+ // Find real maxcount
2896
  if ( ! $max_count ) {
2897
  $max_count = wppa_opt( 'comten_count' );
2898
  }
2899
 
2900
+ // Find raw commented photo ids
2901
+ $photo_ids = $wpdb->get_col( $wpdb->prepare( "SELECT photo FROM $wpdb->wppa_comments
2902
+ WHERE status = 'approved'
2903
+ ORDER BY timestamp DESC LIMIT %d", 100 * $max_count ) );
2904
+
2905
  $result = array();
2906
 
2907
+ // Get unique photo ids in possibly supplied albums
2908
  if ( is_array( $photo_ids ) ) {
2909
  foreach( $photo_ids as $ph ) {
2910
+ if ( empty( $albums ) || in_array( wppa_get_photo_item( $ph, 'album' ), $albums ) || ( count( $albums ) == 1 && $albums[0] == '0' ) ) {
2911
+ if ( ! in_array( $ph, $result ) ) {
2912
+ $result[] = $ph;
 
 
2913
  }
2914
  }
2915
  }
2916
  }
2917
 
2918
+ // Remove void album photo items
2919
+ $result = array_diff( $result, wppa_get_void_pids() );
2920
+
2921
+ // Clip to max count
2922
+ if ( count( $result ) > $max_count ) {
2923
+ $result = array_slice( $result, 0, $max_count );
2924
+ }
2925
+
2926
  return $result;
2927
  }
2928
 
2929
+ // Get array of void album ids
2930
+ function wppa_get_void_aids() {
2931
+ global $wpdb;
2932
+
2933
+ // Find voided albums
2934
+ $void_albs = array();
2935
+ if ( ! wppa_user_is( 'administrator' ) ) {
2936
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'hidden'" ) );
2937
+ }
2938
+ if ( ! is_user_logged_in() ) {
2939
+ $void_albs = array_merge( $void_albs, $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE status = 'private'" ) );
2940
+ }
2941
+
2942
+ return $void_albs;
2943
+ }
2944
+
2945
+ // Get array of photo ids that reside in void albums
2946
+ function wppa_get_void_pids() {
2947
+ global $wpdb;
2948
+
2949
+ $void_albs = wppa_get_void_aids();
2950
+ if ( ! count( $void_albs ) ) {
2951
+ return array();
2952
+ }
2953
+
2954
+ $void_photos = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE album IN (" . implode( ',', $void_albs ) . ")" );
2955
+ return $void_photos;
2956
+ }
2957
+
2958
  // Retrieve a get-vareiable, sanitized and post-processed
2959
  // Return '1' if set without value, return false when value is 'nil'
2960
  function wppa_get_get( $index ) {
wppa-widget-functions.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-widget-functions.php
3
  /* Package: wp-photo-album-plus
4
  /*
5
- /* Version 8.0.00.022
6
  /*
7
  */
8
 
@@ -160,6 +160,14 @@ global $wpdb;
160
  if ( $query ) {
161
  $photos = $wpdb->get_results( $query, ARRAY_A );
162
  wppa_dbg_msg( 'Potd query: '.$query );
 
 
 
 
 
 
 
 
163
  }
164
  else {
165
  $photos = array();
@@ -582,13 +590,11 @@ global $wppa_lang;
582
  wppa_mktree( $root );
583
  }
584
 
585
- return $root . '/' . $wppa_lang . '-' . ( is_user_logged_in() ? 'login-' : '' ) . $widget_id;
586
  }
587
 
588
  function wppa_remove_widget_cache_path( $name = '', $immediate = false ) {
589
 
590
- $root = wppa_get_widget_cache_root();
591
-
592
  // Delete a named cachefile immediately
593
  if ( $name ) {
594
  $file = wppa_get_widget_cache_path( $name );
@@ -598,15 +604,9 @@ function wppa_remove_widget_cache_path( $name = '', $immediate = false ) {
598
  }
599
  }
600
 
601
- // Delete old and obsolete cachefiles only when they are older than 7 days, or immediate
602
- $files = wppa_glob( $root . '/*' );
603
- $nfiles = count( $files );
604
- if ( $nfiles ) {
605
- foreach( $files as $file ) {
606
- if ( $immediate || wppa_filetime( $file ) < ( time() - 7 * 24 * 3600 ) ) {
607
- wppa_unlink( $file );
608
- }
609
- }
610
  }
611
  }
612
 
2
  /* wppa-widget-functions.php
3
  /* Package: wp-photo-album-plus
4
  /*
5
+ /* Version 8.0.04.004
6
  /*
7
  */
8
 
160
  if ( $query ) {
161
  $photos = $wpdb->get_results( $query, ARRAY_A );
162
  wppa_dbg_msg( 'Potd query: '.$query );
163
+
164
+ // Strip void photos
165
+ $void = wppa_get_void_pids();
166
+ if ( count ( $void ) ) foreach( array_keys( $photos ) as $key ) {
167
+ if ( in_array( $photos[$key]['id'], $void ) ) {
168
+ unset( $photos[$key] );
169
+ }
170
+ }
171
  }
172
  else {
173
  $photos = array();
590
  wppa_mktree( $root );
591
  }
592
 
593
+ return $root . '/' . $wppa_lang . '-' . ( is_user_logged_in() ? 'login-' : '' ) . ( wppa_user_is( 'administrator' ) ? 'admin-' : '' ) . $widget_id;
594
  }
595
 
596
  function wppa_remove_widget_cache_path( $name = '', $immediate = false ) {
597
 
 
 
598
  // Delete a named cachefile immediately
599
  if ( $name ) {
600
  $file = wppa_get_widget_cache_path( $name );
604
  }
605
  }
606
 
607
+ $root = wppa_get_widget_cache_root();
608
+ if ( wppa_is_dir( $root ) ) {
609
+ wppa_tree_empty( $root );
 
 
 
 
 
 
610
  }
611
  }
612
 
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.003
7
  *
8
  */
9
 
@@ -471,6 +471,7 @@ global $wpdb;
471
  'displayopts' => '0,0,0,0',
472
  'upload_limit_tree' => '0',
473
  'scheduledel' => '',
 
474
  ) );
475
 
476
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
@@ -505,9 +506,10 @@ global $wpdb;
505
  zoomable,
506
  displayopts,
507
  upload_limit_tree,
508
- scheduledel
 
509
  )
510
- VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s ,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
511
  $args['id'],
512
  trim( $args['name'] ),
513
  trim( $args['description'] ),
@@ -538,7 +540,8 @@ global $wpdb;
538
  $args['zoomable'],
539
  $args['displayopts'],
540
  $args['upload_limit_tree'],
541
- $args['scheduledel']
 
542
  );
543
  $iret = $wpdb->query( $query );
544
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
471
  'displayopts' => '0,0,0,0',
472
  'upload_limit_tree' => '0',
473
  'scheduledel' => '',
474
+ 'status' => 'publish',
475
  ) );
476
 
477
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
506
  zoomable,
507
  displayopts,
508
  upload_limit_tree,
509
+ scheduledel,
510
+ status
511
  )
512
+ VALUES ( %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s ,%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s )",
513
  $args['id'],
514
  trim( $args['name'] ),
515
  trim( $args['description'] ),
540
  $args['zoomable'],
541
  $args['displayopts'],
542
  $args['upload_limit_tree'],
543
+ $args['scheduledel'],
544
+ $args['status']
545
  );
546
  $iret = $wpdb->query( $query );
547
 
wppa-wpdb-update.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
- * Version 7.7.05.002
7
  *
8
  */
9
 
@@ -116,6 +116,10 @@ global $wpdb;
116
  case 'scheduledel':
117
  $doit = true;
118
  break;
 
 
 
 
119
  default:
120
  wppa_log( 'Error', 'Not implemented in wppa_update_album(): '.$itemname );
121
  return false;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
+ * Version 8.0.04.004
7
  *
8
  */
9
 
116
  case 'scheduledel':
117
  $doit = true;
118
  break;
119
+ case 'status':
120
+ if ( in_array( $itemvalue, array( 'publish', 'private', 'hidden' ) ) ) {
121
+ $doit = true;
122
+ }
123
  default:
124
  wppa_log( 'Error', 'Not implemented in wppa_update_album(): '.$itemname );
125
  return false;
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: 8.0.04.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,7 +24,7 @@ global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
- $wppa_api_version = '8.0.04.003'; // 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: 8.0.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
 
25
  /* WPPA GLOBALS */
26
  global $wppa_api_version;
27
+ $wppa_api_version = '8.0.04.004'; // WPPA software version
28
  global $wppa_revno;
29
  $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30