WP Photo Album Plus - Version 7.7.02.005

Version Description

= 7.7.02 =

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

Release Info

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

Code changes from version 7.7.02.004 to 7.7.02.005

changelog.txt CHANGED
@@ -6,6 +6,11 @@ WP Photo Album Plus Changelog
6
  * New setting: Table VI-C14: Album id on cover is link. The album number on the cover links to the album admin page of the album for those users who have the rights to edit the album info.
7
  * On the Album Admin page you can now also enter an album id to edit the album directly without the need to locate the album in the albumtable.
8
  * Overruling display options as introduced in 7.7.01 not always worked correctly. Fixed.
 
 
 
 
 
9
 
10
  = 7.7.01 =
11
 
6
  * New setting: Table VI-C14: Album id on cover is link. The album number on the cover links to the album admin page of the album for those users who have the rights to edit the album info.
7
  * On the Album Admin page you can now also enter an album id to edit the album directly without the need to locate the album in the albumtable.
8
  * Overruling display options as introduced in 7.7.01 not always worked correctly. Fixed.
9
+ * When the number of frontend uploads was set independant of albums, frontend upload did not took into account that a deleted photo may be replaced by a different one. Fixed.
10
+ * New setting: Table IV-E21: Contest comment visibility. The policy to display comments on the contest display.
11
+ Possible options are: 'None', 'Commenter', 'Commenter and photo owner', 'Every visitor'. Note: Admin always sees the comments.
12
+ * On the album admin page one can now specify a max upload per user for the entire tree of albums below the current album (inclusive).
13
+ This upload limit superseeds all other frontend upload limits.
14
 
15
  = 7.7.01 =
16
 
wppa-ajax.php CHANGED
@@ -3217,7 +3217,7 @@ global $wppa;
3217
  case 'wppa_pagelinks_max':
3218
  wppa_ajax_check_range( $value, false, '0', false, __( 'Max Pagelinks', 'wp-photo-album-plus' ) );
3219
  break;
3220
- case 'wppa_thumb_area_size':
3221
  wppa_ajax_check_range( $value, false, '0', false, __( 'Thumbnail area max size', 'wp-photo-album-plus' ) );
3222
  break;
3223
  case 'wppa_cover_spacing':
3217
  case 'wppa_pagelinks_max':
3218
  wppa_ajax_check_range( $value, false, '0', false, __( 'Max Pagelinks', 'wp-photo-album-plus' ) );
3219
  break;
3220
+ case 'wppa_area_size':
3221
  wppa_ajax_check_range( $value, false, '0', false, __( 'Thumbnail area max size', 'wp-photo-album-plus' ) );
3222
  break;
3223
  case 'wppa_cover_spacing':
wppa-album-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
- * Version 7.7.02.001
7
  *
8
  */
9
 
@@ -328,6 +328,7 @@ global $wppa_revno;
328
  $cover_type = $albuminfo['cover_type'];
329
  $main_photo = $albuminfo['main_photo'];
330
  $upload_limit = $albuminfo['upload_limit'];
 
331
  $cats = stripslashes( trim( $albuminfo['cats'], ',' ) );
332
  $default_tags = trim( $albuminfo['default_tags'], ',' );
333
  $cover_linktype = $albuminfo['cover_linktype'];
@@ -729,6 +730,19 @@ global $wppa_revno;
729
  echo '. ';
730
  }
731
 
 
 
 
 
 
 
 
 
 
 
 
 
 
732
  echo '<br />';
733
 
734
  // Need this the next 5 items
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
328
  $cover_type = $albuminfo['cover_type'];
329
  $main_photo = $albuminfo['main_photo'];
330
  $upload_limit = $albuminfo['upload_limit'];
331
+ $tree_limit = $albuminfo['upload_limit_tree'];
332
  $cats = stripslashes( trim( $albuminfo['cats'], ',' ) );
333
  $default_tags = trim( $albuminfo['default_tags'], ',' );
334
  $cover_linktype = $albuminfo['cover_linktype'];
730
  echo '. ';
731
  }
732
 
733
+ // Tree limit
734
+ echo __( 'Tree upload limit', 'wp-photo-album-plus' ) . ':
735
+ <input
736
+ type="number"
737
+ min="0"
738
+ title="' . esc_attr( 'The upload limit for this album and all its (grand)children. ' .
739
+ 'This setting overrules all other limits that may apply to this album or its (grand)children. ' .
740
+ '0 means no limit.', 'wp-photo-album-plus' ) . '"
741
+ value="' . $tree_limit . '"
742
+ onchange="wppaAjaxUpdateAlbum( ' . $id . ', \'upload_limit_tree\', this )"
743
+ style="cursor:pointer;"
744
+ />';
745
+
746
  echo '<br />';
747
 
748
  // Need this the next 5 items
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 7.7.01.011
7
  *
8
  */
9
 
@@ -293,11 +293,17 @@ global $wpdb;
293
  </td>
294
  <td class="wppa-contest-table-rater" >';
295
  foreach( $ratings as $rating ) {
296
- $comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment FROM $wpdb->wppa_comments WHERE photo = %d AND userid = %d", $id, $rating['userid'] ) );
 
 
 
 
 
297
  if ( $comment ) {
298
  $result .= '
299
  <a
300
  title="' . esc_attr( $comment ) . '"
 
301
  onclick="alert(\'' . esc_js( $comment ) . '\')"
302
  >' . wppa_get_user_by( 'id', $rating['userid'] )->display_name . '
303
  </a>
@@ -388,6 +394,41 @@ global $wpdb;
388
  return $result;
389
  }
390
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
391
  // Search box
392
  function wppa_search_box() {
393
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
293
  </td>
294
  <td class="wppa-contest-table-rater" >';
295
  foreach( $ratings as $rating ) {
296
+ if ( wppa_contest_display_comment( $id, $rating['userid'] ) ) {
297
+ $comment = $wpdb->get_var( $wpdb->prepare( "SELECT comment FROM $wpdb->wppa_comments WHERE photo = %d AND userid = %d", $id, $rating['userid'] ) );
298
+ }
299
+ else {
300
+ $comment = '';
301
+ }
302
  if ( $comment ) {
303
  $result .= '
304
  <a
305
  title="' . esc_attr( $comment ) . '"
306
+ style="cursor:pointer;"
307
  onclick="alert(\'' . esc_js( $comment ) . '\')"
308
  >' . wppa_get_user_by( 'id', $rating['userid'] )->display_name . '
309
  </a>
394
  return $result;
395
  }
396
 
397
+ // Should comment be visible on contest display?
398
+ function wppa_contest_display_comment( $photoid, $userid ) {
399
+
400
+ // Admin sees everything independant of policy
401
+ if ( wppa_user_is( 'administrator' ) ) {
402
+ return true;
403
+ }
404
+
405
+ // Find the policy
406
+ $policy = wppa_opt( 'contest_comment_policy' );
407
+
408
+ switch ( $policy ) {
409
+
410
+ // Nobody (admin has been covered above)?
411
+ case 'none':
412
+ return false;
413
+ break;
414
+
415
+ // My userid == comment/rating userid?
416
+ case 'comowner':
417
+ return ( wppa_get_user( 'id' ) == $userid );
418
+ break;
419
+
420
+ // My userid == comment/rating userid OR my login name == photo owner?
421
+ case 'owners':
422
+ return ( wppa_get_user( 'id' ) == $userid ) || ( wppa_get_user( 'login' ) == wppa_get_photo_item( $photoid, 'owner' ) );
423
+ break;
424
+
425
+ // case 'all':
426
+ default:
427
+ return true;
428
+ break;
429
+ }
430
+ }
431
+
432
  // Search box
433
  function wppa_search_box() {
434
 
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 7.7.01.006
6
  *
7
  */
8
 
@@ -1276,10 +1276,41 @@ static $result_cache;
1276
  }
1277
 
1278
  // Return the allowed number of uploads for a certain user. -1 = unlimited
1279
- // If album <> 0 and 'role_limit_per_album' is set, look at the album, not global
 
 
1280
  function wppa_allow_user_uploads( $album = false ) {
1281
  global $wpdb;
1282
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1283
  // Get the limits
1284
  $limits = wppa_get_user_upload_limits();
1285
  $temp = explode( '/', $limits );
@@ -1304,7 +1335,7 @@ global $wpdb;
1304
  $album_clause = sprintf( " AND album = %d", $album );
1305
  }
1306
  else {
1307
- $album_clause = "";
1308
  }
1309
 
1310
  // Get the user
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.7.02.005
6
  *
7
  */
8
 
1276
  }
1277
 
1278
  // Return the allowed number of uploads for a certain user. -1 = unlimited
1279
+ // First: if album <> 0 and a (grand)parent has a tree limit set, examine the tree
1280
+ // A set tree limit has priority over other limitations
1281
+ // Then: if album <> 0 and 'role_limit_per_album' is set, look at the album, not global
1282
  function wppa_allow_user_uploads( $album = false ) {
1283
  global $wpdb;
1284
 
1285
+ // PHASE 1 // TEST FOR TREE LIMIT
1286
+ // Find possible (grand)parent treelimit
1287
+ if ( $album ) {
1288
+ $parent = $album; // Fake initial parent to album mitsself (for the while loop)
1289
+ $last_parent = $album;
1290
+ $tree_limit = '0'; // Init to 0: no limit
1291
+ while ( $parent > '0' && $tree_limit == '0' ) {
1292
+ $tree_limit = wppa_get_album_item( $parent, 'upload_limit_tree' );
1293
+ $last_parent = $parent;
1294
+ $parent = wppa_get_album_item( $parent, 'a_parent' );
1295
+ }
1296
+ if ( $tree_limit ) {
1297
+ $me = wppa_get_user();
1298
+ $tree_albums = wppa_alb_to_enum_children( $last_parent );
1299
+ $alb_list = str_replace( '.', ',', $tree_albums );
1300
+ $count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*)
1301
+ FROM $wpdb->wppa_photos
1302
+ WHERE album IN ($alb_list)
1303
+ AND owner = %s", $me ) );
1304
+ if ( $count >= $tree_limit ) {
1305
+ return '0'; // No more left
1306
+ }
1307
+ else {
1308
+ return $tree_limit - $count;
1309
+ }
1310
+ }
1311
+ }
1312
+
1313
+ // PHASE 2 // TEST FOR REGULAR LIMITS
1314
  // Get the limits
1315
  $limits = wppa_get_user_upload_limits();
1316
  $temp = explode( '/', $limits );
1335
  $album_clause = sprintf( " AND album = %d", $album );
1336
  }
1337
  else {
1338
+ $album_clause = " AND album > 0";
1339
  }
1340
 
1341
  // Get the user
wppa-defaults.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
- * Version 7.7.02.002
7
  *
8
  */
9
 
@@ -635,6 +635,7 @@ horizrailenabled:false,";
635
  'wppa_contest_sortby' => 'average',
636
  'wppa_contest_number' => 'none',
637
  'wppa_contest_max' => '10',
 
638
 
639
  // F Comments
640
  'wppa_comment_login' => 'no',
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains default settings
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
635
  'wppa_contest_sortby' => 'average',
636
  'wppa_contest_number' => 'none',
637
  'wppa_contest_max' => '10',
638
+ 'wppa_contest_comment_policy' => 'all',
639
 
640
  // F Comments
641
  'wppa_comment_login' => 'no',
wppa-items.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
- * Version 7.7.02.004
7
  *
8
  */
9
 
@@ -1077,13 +1077,13 @@ static $cache;
1077
  foreach( $albs as $alb ) {
1078
  if ( _wppa_is_item_displayable( $alb, $item, $default_slug ) ) {
1079
  $cache[$xalb . $item . $default_slug] = true;
1080
- wppa_log( 'obs', "Function called: wppa_is_item_displayable( $xalb, $item, $default_slug ) returned true" );
1081
  return true;
1082
  }
1083
  }
1084
  }
1085
  $cache[$xalb . $item . $default_slug] = false;
1086
- wppa_log( 'obs', "Function called: wppa_is_item_displayable( $xalb, $item, $default_slug ) returned false" );
1087
  return false;
1088
  }
1089
  function _wppa_is_item_displayable( $alb, $item, $default_slug ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains functions to retrieve album and photo items
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
1077
  foreach( $albs as $alb ) {
1078
  if ( _wppa_is_item_displayable( $alb, $item, $default_slug ) ) {
1079
  $cache[$xalb . $item . $default_slug] = true;
1080
+ // wppa_log( 'obs', "Function called: wppa_is_item_displayable( $xalb, $item, $default_slug ) returned true" );
1081
  return true;
1082
  }
1083
  }
1084
  }
1085
  $cache[$xalb . $item . $default_slug] = false;
1086
+ // wppa_log( 'obs', "Function called: wppa_is_item_displayable( $xalb, $item, $default_slug ) returned false" );
1087
  return false;
1088
  }
1089
  function _wppa_is_item_displayable( $alb, $item, $default_slug ) {
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 7.7.02.002
7
  *
8
  */
9
 
@@ -5494,6 +5494,20 @@ global $wppa_supported_camara_brands;
5494
  $tags = 'rating,layout';
5495
  wppa_setting($slug, '20', $name, $desc, $html, $help, $clas, $tags);
5496
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5497
  }
5498
  wppa_setting_subheader( 'F', '1', __( 'Comments related settings' , 'wp-photo-album-plus'), 'wppa_comment_' );
5499
  {
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
5494
  $tags = 'rating,layout';
5495
  wppa_setting($slug, '20', $name, $desc, $html, $help, $clas, $tags);
5496
 
5497
+ $name = __('Contest comment visibility', 'wp-photo-album-plus');
5498
+ $desc = __('The policy to display comments on the contest display', 'wp-photo-album-plus');
5499
+ $help = __('Admin always sees the comments', 'wp-photo-album-plus');
5500
+ $slug = 'wppa_contest_comment_policy';
5501
+ $opts = array( __('None', 'wp-photo-album-plus' ),
5502
+ __('Commenter', 'wp-photo-album-plus'),
5503
+ __('Commenter and photo owner', 'wp-photo-album-plus'),
5504
+ __('Every visitor', 'wp-photo-album-plus'));
5505
+ $vals = array( 'none', 'comowner', 'owners', 'all' );
5506
+ $html = wppa_select($slug, $opts, $vals);
5507
+ $clas = '';
5508
+ $tags = 'rating,layout';
5509
+ wppa_setting($slug, '21', $name, $desc, $html, $help, $clas, $tags);
5510
+
5511
  }
5512
  wppa_setting_subheader( 'F', '1', __( 'Comments related settings' , 'wp-photo-album-plus'), 'wppa_comment_' );
5513
  {
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 7.7.01.001
7
  *
8
  */
9
 
@@ -72,6 +72,7 @@ global $wppa_error;
72
  sname text NOT NULL,
73
  zoomable tinytext NOT NULL,
74
  displayopts tinytext NOT NULL,
 
75
  PRIMARY KEY (id)
76
  ) DEFAULT CHARACTER SET utf8;";
77
 
@@ -647,6 +648,10 @@ global $wppa_error;
647
  if ( $old_rev <= '7610' ) {
648
  delete_option( 'wppa_child_list' );
649
  }
 
 
 
 
650
  }
651
 
652
  // Set Defaults
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
72
  sname text NOT NULL,
73
  zoomable tinytext NOT NULL,
74
  displayopts tinytext NOT NULL,
75
+ upload_limit_tree tinytext NOT NULL,
76
  PRIMARY KEY (id)
77
  ) DEFAULT CHARACTER SET utf8;";
78
 
648
  if ( $old_rev <= '7610' ) {
649
  delete_option( 'wppa_child_list' );
650
  }
651
+
652
+ if ( $old_rev <= '7702005' ) {
653
+ $wpdb->query( "UPDATE $wpdb->wppa_albums SET upload_limit_tree = '0' WHERE upload_limit_tree = ''" );
654
+ }
655
  }
656
 
657
  // Set Defaults
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.01.001
7
  *
8
  */
9
 
@@ -469,6 +469,7 @@ global $wpdb;
469
  'sname' => wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : __( 'New Album', 'wp-photo-album-plus' ) ),
470
  'zoomable' => '',
471
  'displayopts' => '0,0,0,0',
 
472
  ) );
473
 
474
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
@@ -501,9 +502,10 @@ global $wpdb;
501
  indexdtm,
502
  sname,
503
  zoomable,
504
- displayopts
 
505
  )
506
- 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 )",
507
  $args['id'],
508
  trim( $args['name'] ),
509
  trim( $args['description'] ),
@@ -532,7 +534,8 @@ global $wpdb;
532
  $args['indexdtm'],
533
  $args['sname'],
534
  $args['zoomable'],
535
- $args['displayopts']
 
536
  );
537
  $iret = $wpdb->query( $query );
538
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that add new records
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
469
  'sname' => wppa_sanitize_album_photo_name( isset( $args['name'] ) ? $args['name'] : __( 'New Album', 'wp-photo-album-plus' ) ),
470
  'zoomable' => '',
471
  'displayopts' => '0,0,0,0',
472
+ 'upload_limit_tree' => '0',
473
  ) );
474
 
475
  if ( ! wppa_is_id_free( WPPA_ALBUMS, $args['id'] ) ) $args['id'] = wppa_nextkey( WPPA_ALBUMS );
502
  indexdtm,
503
  sname,
504
  zoomable,
505
+ displayopts,
506
+ upload_limit_tree
507
  )
508
+ 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 )",
509
  $args['id'],
510
  trim( $args['name'] ),
511
  trim( $args['description'] ),
534
  $args['indexdtm'],
535
  $args['sname'],
536
  $args['zoomable'],
537
+ $args['displayopts'],
538
+ $args['upload_limit_tree']
539
  );
540
  $iret = $wpdb->query( $query );
541
 
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.01.001
7
  *
8
  */
9
 
@@ -108,6 +108,11 @@ global $wpdb;
108
  case 'displayopts':
109
  $doit = true;
110
  break;
 
 
 
 
 
111
  default:
112
  wppa_log( 'Error', 'Not implemented in wppa_update_album(): '.$itemname );
113
  return false;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level wpdb routines that update records
6
+ * Version 7.7.02.005
7
  *
8
  */
9
 
108
  case 'displayopts':
109
  $doit = true;
110
  break;
111
+ case 'upload_limit_tree':
112
+ if ( is_numeric( $itemvalue ) ) {
113
+ $doit = true;
114
+ }
115
+ break;
116
  default:
117
  wppa_log( 'Error', 'Not implemented in wppa_update_album(): '.$itemname );
118
  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: 7.7.02.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/
@@ -23,8 +23,10 @@ global $wpdb;
23
  global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
- global $wppa_revno; $wppa_revno = '7701'; // WPPA db version
27
- global $wppa_api_version; $wppa_api_version = '7.7.02.004'; // WPPA software version
 
 
28
 
29
  /* Init page js data */
30
  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.7.02.005
6
  * Author: J.N. Breetvelt a.k.a. OpaJaap
7
  * Author URI: http://wppa.opajaap.nl/
8
  * Plugin URI: http://wordpress.org/extend/plugins/wp-photo-album-plus/
23
  global $wp_version;
24
 
25
  /* WPPA GLOBALS */
26
+ global $wppa_api_version;
27
+ $wppa_api_version = '7.7.02.005'; // WPPA software version
28
+ global $wppa_revno;
29
+ $wppa_revno = str_replace( '.', '', $wppa_api_version ); // WPPA db version
30
 
31
  /* Init page js data */
32
  global $wppa_js_page_data; $wppa_js_page_data = '';