WP Photo Album Plus - Version 6.5.09

Version Description

Download this release

Release Info

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

Code changes from version 6.5.08 to 6.5.09

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, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
5
- Version: 6.5.08
6
  Stable tag: 6.5.08
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
@@ -180,6 +180,13 @@ Oh, just Google on 'picture resizer' and you will find a bunch of free programs
180
 
181
  See for additional information: http://www.wppa.nl/changelog/
182
 
 
 
 
 
 
 
 
183
  = 6.5.08 =
184
 
185
  = Bug Fixes =
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, gallery, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto
5
+ Version: 6.5.09
6
  Stable tag: 6.5.08
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
180
 
181
  See for additional information: http://www.wppa.nl/changelog/
182
 
183
+ = 6.5.09 =
184
+
185
+ = Bug Fixes =
186
+
187
+ * Most of the albums did not show up in the album table for non admin users with album admin access to a few albums. Fixed.
188
+ * Fixed a capacity issue with very many grant parents.
189
+
190
  = 6.5.08 =
191
 
192
  = Bug Fixes =
wppa-album-admin-autosave.php CHANGED
@@ -1028,9 +1028,11 @@ global $wpdb;
1028
  $albums = $wpdb->get_results( "SELECT * FROM `" . WPPA_ALBUMS . "` ORDER BY " . get_option( 'wppa_album_order_'.wppa_get_user(), 'id' ) . ( get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' ) == 'yes' ? " DESC" : "" ) , ARRAY_A );
1029
 
1030
  // Remove non accessable albums
1031
- foreach ( array_keys( $albums ) as $idx ) {
1032
- if ( ! wppa_have_access( $albums[$idx]['id'] ) ) {
1033
- unset( $albums[$idx] );
 
 
1034
  }
1035
  }
1036
  $count = count( $albums );
@@ -1371,9 +1373,11 @@ global $wpdb;
1371
  $albums = $wpdb->get_results( "SELECT * FROM `" . WPPA_ALBUMS . "` ORDER BY " . get_option( 'wppa_album_order_'.wppa_get_user(), 'id' ) . ( get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' ) == 'yes' ? " DESC" : "" ) , ARRAY_A );
1372
 
1373
  // Remove non accessable albums
1374
- foreach ( array_keys( $albums ) as $idx ) {
1375
- if ( ! wppa_have_access( $albums[$idx]['id'] ) ) {
1376
- unset( $albums[$idx] );
 
 
1377
  }
1378
  }
1379
  $count = count( $albums );
1028
  $albums = $wpdb->get_results( "SELECT * FROM `" . WPPA_ALBUMS . "` ORDER BY " . get_option( 'wppa_album_order_'.wppa_get_user(), 'id' ) . ( get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' ) == 'yes' ? " DESC" : "" ) , ARRAY_A );
1029
 
1030
  // Remove non accessable albums
1031
+ $temp = $albums;
1032
+ $albums = array();
1033
+ foreach ( array_keys( $temp ) as $idx ) {
1034
+ if ( wppa_have_access( $temp[$idx]['id'] ) ) {
1035
+ $albums[] = $temp[$idx];
1036
  }
1037
  }
1038
  $count = count( $albums );
1373
  $albums = $wpdb->get_results( "SELECT * FROM `" . WPPA_ALBUMS . "` ORDER BY " . get_option( 'wppa_album_order_'.wppa_get_user(), 'id' ) . ( get_option( 'wppa_album_order_' . wppa_get_user() . '_reverse' ) == 'yes' ? " DESC" : "" ) , ARRAY_A );
1374
 
1375
  // Remove non accessable albums
1376
+ $temp = $albums;
1377
+ $albums = array();
1378
+ foreach ( array_keys( $temp ) as $idx ) {
1379
+ if ( wppa_have_access( $temp[$idx]['id'] ) ) {
1380
+ $albums[] = $temp[$idx];
1381
  }
1382
  }
1383
  $count = count( $albums );
wppa-settings-autosave.php CHANGED
@@ -7318,60 +7318,86 @@ global $wp_version;
7318
  $tags = 'system';
7319
  wppa_setting(false, '19', $name, $desc, $html, $help, $clas, $tags);
7320
 
7321
- $name = __('From', 'wp-photo-album-plus');
7322
- $desc = __('Move from album', 'wp-photo-album-plus');
7323
- $help = '';
7324
- $slug = 'wppa_move_all_photos_from';
7325
- $html = '<select' .
7326
- ' id=""' .
7327
- ' onchange="wppaAjaxUpdateOptionValue(\'move_all_photos_from\',this)"' .
7328
- ' name="move_all_photos_to"' .
7329
- ' style="float:left;"' .
7330
- ' >'.
7331
- wppa_album_select_a(array( 'addpleaseselect'=>true,
7332
- 'path'=>true,
7333
- 'selected'=>get_option('wppa_move_all_photos_from')
7334
- )).
7335
- '</select>' .
7336
- '<img' .
7337
- ' id="img_move_all_photos_from"' .
7338
- ' class=""' .
7339
- ' src="'.wppa_get_imgdir().'star.png"' .
7340
- ' title="'.__('Setting unmodified', 'wp-photo-album-plus').'"' .
7341
- ' style="padding-left:4px; float:left; height:16px; width:16px;"' .
7342
- ' />';
7343
- $html = array($html, '', '', '');
7344
- $clas = '';
7345
- $tags = 'system';
7346
- wppa_setting(false, '19.1', $name, $desc, $html, $help, $clas, $tags);
7347
-
7348
- $name = __('To', 'wp-photo-album-plus');
7349
- $desc = __('Move to album', 'wp-photo-album-plus');
7350
- $help = '';
7351
- $slug = 'wppa_move_all_photos_to';
7352
- $html = '<select' .
7353
- ' id=""' .
7354
- ' onchange="wppaAjaxUpdateOptionValue(\'move_all_photos_to\',this)"' .
7355
- ' name="move_all_photos_to"' .
7356
- ' style="float:left;"' .
7357
- ' >'.
7358
- wppa_album_select_a(array( 'addpleaseselect'=>true,
7359
- 'path'=>true,
7360
- 'selected'=>get_option('wppa_move_all_photos_to')
7361
- )).
7362
- '</select>' .
7363
- '<img' .
7364
- ' id="img_move_all_photos_to"' .
7365
- ' class=""' .
7366
- ' src="'.wppa_get_imgdir().'star.png"' .
7367
- ' title="'.__('Setting unmodified', 'wp-photo-album-plus').'"' .
7368
- ' style="padding-left:4px; float:left; height:16px; width:16px;"' .
7369
- ' />';
7370
- $html = array($html, '', '', '');
7371
- $clas = '';
7372
- $tags = 'system';
7373
- wppa_setting(false, '19.2', $name, $desc, $html, $help, $clas, $tags);
7374
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7375
  /*
7376
  $name = __('Test proc');
7377
  $desc = __('For OpaJaap only');
7318
  $tags = 'system';
7319
  wppa_setting(false, '19', $name, $desc, $html, $help, $clas, $tags);
7320
 
7321
+ if ( wppa_get_total_album_count() > 200 ) { // Many albums: input id
7322
+
7323
+ $name = __('From', 'wp-photo-album-plus');
7324
+ $desc = __('Move from album number', 'wp-photo-album-plus');
7325
+ $help = '';
7326
+ $slug = 'wppa_move_all_photos_from';
7327
+ $html = wppa_input($slug, '100px' );
7328
+ $html = array($html, '', '', '');
7329
+ $clas = '';
7330
+ $tags = 'system';
7331
+ wppa_setting(false, '19.1', $name, $desc, $html, $help, $clas, $tags);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7332
 
7333
+ $name = __('To', 'wp-photo-album-plus');
7334
+ $desc = __('Move to album number', 'wp-photo-album-plus');
7335
+ $help = '';
7336
+ $slug = 'wppa_move_all_photos_to';
7337
+ $html = wppa_input($slug, '100px' );
7338
+ $html = array($html, '', '', '');
7339
+ $clas = '';
7340
+ $tags = 'system';
7341
+ wppa_setting(false, '19.2', $name, $desc, $html, $help, $clas, $tags);
7342
+
7343
+ }
7344
+ else { // Few albums: selectionbox
7345
+
7346
+ $name = __('From', 'wp-photo-album-plus');
7347
+ $desc = __('Move from album', 'wp-photo-album-plus');
7348
+ $help = '';
7349
+ $slug = 'wppa_move_all_photos_from';
7350
+ $html = '<select' .
7351
+ ' id=""' .
7352
+ ' onchange="wppaAjaxUpdateOptionValue(\'move_all_photos_from\',this)"' .
7353
+ ' name="move_all_photos_to"' .
7354
+ ' style="float:left;"' .
7355
+ ' >'.
7356
+ wppa_album_select_a(array( 'addpleaseselect'=>true,
7357
+ 'path'=>true,
7358
+ 'selected'=>get_option('wppa_move_all_photos_from')
7359
+ )).
7360
+ '</select>' .
7361
+ '<img' .
7362
+ ' id="img_move_all_photos_from"' .
7363
+ ' class=""' .
7364
+ ' src="'.wppa_get_imgdir().'star.ico"' .
7365
+ ' title="'.__('Setting unmodified', 'wp-photo-album-plus').'"' .
7366
+ ' style="padding-left:4px; float:left; height:16px; width:16px;"' .
7367
+ ' />';
7368
+ $html = array($html, '', '', '');
7369
+ $clas = '';
7370
+ $tags = 'system';
7371
+ wppa_setting(false, '19.1', $name, $desc, $html, $help, $clas, $tags);
7372
+
7373
+ $name = __('To', 'wp-photo-album-plus');
7374
+ $desc = __('Move to album', 'wp-photo-album-plus');
7375
+ $help = '';
7376
+ $slug = 'wppa_move_all_photos_to';
7377
+ $html = '<select' .
7378
+ ' id=""' .
7379
+ ' onchange="wppaAjaxUpdateOptionValue(\'move_all_photos_to\',this)"' .
7380
+ ' name="move_all_photos_to"' .
7381
+ ' style="float:left;"' .
7382
+ ' >'.
7383
+ wppa_album_select_a(array( 'addpleaseselect'=>true,
7384
+ 'path'=>true,
7385
+ 'selected'=>get_option('wppa_move_all_photos_to')
7386
+ )).
7387
+ '</select>' .
7388
+ '<img' .
7389
+ ' id="img_move_all_photos_to"' .
7390
+ ' class=""' .
7391
+ ' src="'.wppa_get_imgdir().'star.ico"' .
7392
+ ' title="'.__('Setting unmodified', 'wp-photo-album-plus').'"' .
7393
+ ' style="padding-left:4px; float:left; height:16px; width:16px;"' .
7394
+ ' />';
7395
+ $html = array($html, '', '', '');
7396
+ $clas = '';
7397
+ $tags = 'system';
7398
+ wppa_setting(false, '19.2', $name, $desc, $html, $help, $clas, $tags);
7399
+
7400
+ }
7401
  /*
7402
  $name = __('Test proc');
7403
  $desc = __('For OpaJaap only');
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 6.5.08
7
  *
8
  */
9
 
@@ -1783,37 +1783,90 @@ function wppa_credirmsg($dir) {
1783
  // Create grated album(s)
1784
  function wppa_grant_albums( $xparent = false ) {
1785
  global $wpdb;
 
 
 
 
 
 
 
 
 
1786
 
1787
- // Create an album if required
1788
- if ( wppa_switch( 'grant_an_album' )
1789
- && wppa_switch( 'owner_only' )
1790
- && is_user_logged_in()
1791
- && ( current_user_can( 'wppa_upload' ) || wppa_switch( 'user_upload_on' ) ) ) {
1792
- $owner = wppa_get_user( 'login' );
1793
- $user = wppa_get_user( wppa_opt( 'grant_name' ) );
1794
- $parents = explode( ',', wppa_opt( 'grant_parent' ) );
1795
-
1796
- // If a parent is given, and it is a grant parent, only create the granted album inside this parent. Else create all granted albums
1797
- if ( $xparent && in_array( $xparent, $parents ) ) {
1798
- $parents = array( $xparent );
1799
- }
1800
 
1801
- // May be multiple granted parents. Check for all parents.
1802
- foreach( $parents as $parent ) {
1803
- $albs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM `".WPPA_ALBUMS."` WHERE `owner` = %s AND `a_parent` = %s", $owner, $parent ) );
1804
- if ( ! $albs ) { // make an album for this user
1805
- $name = $user;
1806
- $desc = __( 'Default photo album for' , 'wp-photo-album-plus').' '.$user;
1807
- $id = wppa_create_album_entry( array ( 'name' => $name, 'description' => $desc, 'a_parent' => $parent ) );
1808
- if ( $id ) {
1809
- wppa_log( 'Obs', 'Album ' . wppa_get_album_name( $parent ) . ' -> ' . $id . ' for ' . $user . ' created.' );
1810
- }
1811
- else {
1812
- wppa_log( 'Err', 'Could not create subalbum of ' . $parent . ' for ' . $user );
1813
- }
1814
- wppa_flush_treecounts( $parent );
1815
- wppa_index_add( 'album', $id );
1816
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1817
  }
 
 
 
 
1818
  }
1819
- }
 
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 6.5.09
7
  *
8
  */
9
 
1783
  // Create grated album(s)
1784
  function wppa_grant_albums( $xparent = false ) {
1785
  global $wpdb;
1786
+ static $grant_parents;
1787
+ static $my_albs_parents;
1788
+ static $owner;
1789
+ static $user;
1790
+
1791
+ // Feature enabled?
1792
+ if ( ! wppa_switch( 'grant_an_album' ) ) {
1793
+ return;
1794
+ }
1795
 
1796
+ // Owners only?
1797
+ if ( ! wppa_switch( 'owner_only' ) ) {
1798
+ return;
1799
+ }
 
 
 
 
 
 
 
 
 
1800
 
1801
+ // User logged in?
1802
+ if ( ! is_user_logged_in() ) {
1803
+ return;
1804
+ }
1805
+
1806
+ // Can user upload?
1807
+ if ( ! current_user_can( 'wppa_upload' ) && ! wppa_switch( 'user_upload_on' ) ) {
1808
+ return;
1809
+ }
1810
+
1811
+ // Get required data if not done already
1812
+ if ( ! is_array( $grant_parents ) ) {
1813
+ $grant_parents = explode( ',', wppa_opt( 'grant_parent' ) );
1814
+ if ( ! is_array( $grant_parents ) ) {
1815
+ $grant_parents = array( '0' );
1816
+ }
1817
+ }
1818
+ if ( ! $owner ) {
1819
+ $owner = wppa_get_user( 'login' ); // The current users login name
1820
+ }
1821
+ if ( ! is_array( $my_albs_parents ) ) {
1822
+ $query = $wpdb->prepare( "SELECT DISTINCT `a_parent` FROM `" . WPPA_ALBUMS . "` WHERE `owner` = %s", $owner );
1823
+ $my_albs_parents = $wpdb->get_col( $query );
1824
+ if ( ! is_array( $my_albs_parents ) ) {
1825
+ $my_albs_parents = array();
1826
+ }
1827
+ }
1828
+ if ( ! $user ) {
1829
+ $user = wppa_get_user( wppa_opt( 'grant_name' ) ); // The current users name as how the album should be named
1830
+ }
1831
+
1832
+ // If a parent is given and it is not a grant parent, quit
1833
+ if ( $xparent && ! in_array( $xparent, $grant_parents ) ) {
1834
+ return;
1835
+ }
1836
+
1837
+ // If a parent is given, it will now be a grant parent (see directly above), only create the granted album inside this parent.
1838
+ if ( $xparent ) {
1839
+ $parents = array( $xparent );
1840
+ }
1841
+ // Else create granted albums for all grant parents
1842
+ else {
1843
+ $parents = $grant_parents;
1844
+ }
1845
+
1846
+ // Parent independant album data
1847
+ $name = $user;
1848
+ $desc = __( 'Default photo album for', 'wp-photo-album-plus' ) . ' ' . $user;
1849
+
1850
+ // May be multiple granted parents. Check for all parents.
1851
+ foreach( $parents as $parent ) {
1852
+ if ( ! in_array( $parent, $my_albs_parents, true ) ) {
1853
+
1854
+ // make an album for this user
1855
+ $id = wppa_create_album_entry( array ( 'name' => $name, 'description' => $desc, 'a_parent' => $parent ) );
1856
+ if ( $id ) {
1857
+ wppa_log( 'Obs', 'Album ' . wppa_get_album_name( $parent ) . '(' . $parent . ')' .' -> ' . $id . ' for ' . $user . ' created.' );
1858
+
1859
+ // Add this parent to the array of my albums parents
1860
+ $my_albs_parents[] = $parent;
1861
+ }
1862
+ else {
1863
+ wppa_log( 'Err', 'Could not create subalbum of ' . $parent . ' for ' . $user );
1864
  }
1865
+ wppa_flush_treecounts( $parent );
1866
+ wppa_index_add( 'album', $id );
1867
+
1868
+ }
1869
  }
1870
+ wppa_create_pl_htaccess();
1871
+
1872
+ }
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: 6.5.08
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 = '6508'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '6-5-08-006'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime(true);
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: 6.5.09
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 = '6509'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '6-5-09-003'; // WPPA software version
27
 
28
  /* start timers */
29
  global $wppa_starttime; $wppa_starttime = microtime(true);