WP Photo Album Plus - Version 7.2.08.004

Version Description

= 7.2.08 =

  • This version addresses various bug fixes.

= 7.2.07 =

  • This version addresses various bug fixes.

= 7.2.06 =

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

= 7.2.05 =

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

= 7.2.04 =

  • This version addresses various bug fixes and feature requests.

= 7.2.03 =

  • This version addresses various bug fixes and feature requests.

= 7.2.02 =

  • This version addresses various bug fixes and feature requests.

= 7.2.01 =

  • This version addresses various bug fixes and feature requests.

= 7.2.00 =

  • This version addresses various bug fixes and feature requests.

= 7.1.11 =

  • This version addresses various bug fixes and feature requests.

= 7.1.10 =

  • This version addresses various bug fixes and feature requests.

= 7.1.09 =

  • This version addresses various bug fixes and feature requests.

= 7.1.08 =

  • This version addresses various bug fixes and feature requests.

= 7.1.07 =

  • This version addresses various bug fixes and feature requests.

= 7.1.06 =

  • This version addresses various bug fixes and feature requests.

= 7.1.05 =

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

= 7.1.04 =

  • This version addresses various bug fixes.

= 7.1.03 =

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

= 7.1.02 =

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

= 7.1.01 =

  • This version addresses various bug fixes and feature requests.

= 7.1.00 =

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

= 7.0.11 =

  • This version addresses various bug fixes and feature requests.

= 7.0.11 =

  • This version addresses various bug fixes

= 7.0.10 =

  • This version addresses various bug fixes

= 7.0.09 =

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

= 7.0.08 =

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

= 7.0.07 =

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

= 7.0.06 =

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

= 7.0.05 =

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

= 7.0.04 =

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

= 7.0.03 =

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

= 7.0.02 =

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

= 7.0.01 =

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

= 7.0.00 =

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

= 6.9.21 =

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

= 6.9.20 =

  • This version addresses various bug fixes

= 6.9.19 =

  • This version addresses various minor bug fixes

= 6.9.18 =

  • This version addresses various minor bug fixes

= 6.9.17 =

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

= 6.9.16 =

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

= 6.9.15 =

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

= 6.9.14 =

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

= 6.9.13 =

  • Security release.

= 6.9.12 =

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

= 6.9.11 =

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

= 6.9.10 =

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

= 6.9.09 =

  • Panorama support phase III.

= 6.9.08 =

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

= 6.9.07 =

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

= 6.9.06 =

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

= 6.9.05 =

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

= 6.9.04 =

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

= 6.9.03 =

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

= 6.9.02 =

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

= 6.9.01 =

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

= 6.9.00 =

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

= 6.8.09

  • This version addresses various bug fixes and code edits.

= 6.8.08 =

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

= 6.8.07 =

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

= 6.8.06 =

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

= 6.8.05 =

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

= 6.8.04 =

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

Release Info

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

Code changes from version 7.2.08.003 to 7.2.08.004

changelog.txt CHANGED
@@ -5,6 +5,7 @@ WP Photo Album Plus Changelog
5
  * Fixed a problem when displaying slideshows with comment field caused by user display names containing (single) quotes.
6
  * Fixed a regression in the interpretation of shortcode arguments since 7.2.07 with respect to accented letters.
7
  * Placeholder code for search box produced an error in certain circumstances. Fixed.
 
8
 
9
  = 7.2.07 =
10
 
5
  * Fixed a problem when displaying slideshows with comment field caused by user display names containing (single) quotes.
6
  * Fixed a regression in the interpretation of shortcode arguments since 7.2.07 with respect to accented letters.
7
  * Placeholder code for search box produced an error in certain circumstances. Fixed.
8
+ * Added plugin AMP to the blacklist, because it completely destroys the dynamic functionality (links, onclick event handlers etc).
9
 
10
  = 7.2.07 =
11
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
- Version: 7.2.08.003
6
  Stable tag: 7.2.07.007
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 7.2.08.004
6
  Stable tag: 7.2.07.007
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
wppa-boxes-html.php CHANGED
@@ -4299,7 +4299,8 @@ global $wpdb;
4299
  $thumb = wppa_cache_thumb( $photo );
4300
  $album = $thumb['album'];
4301
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, page_id FROM $wpdb->wppa_photos
4302
- WHERE album = %s " . wppa_get_photo_order( $album ), $album ), ARRAY_A );
 
4303
  $prevpag = '0';
4304
  $nextpag = '0';
4305
  $curpag = wppa_get_the_ID();
4299
  $thumb = wppa_cache_thumb( $photo );
4300
  $album = $thumb['album'];
4301
  $photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, page_id FROM $wpdb->wppa_photos
4302
+ WHERE album = %s
4303
+ ORDER BY " . wppa_get_poc( $album ), $album ), ARRAY_A );
4304
  $prevpag = '0';
4305
  $nextpag = '0';
4306
  $curpag = wppa_get_the_ID();
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.2.06
6
  *
7
  */
8
 
@@ -597,10 +597,14 @@ function wppa_is_photo_order_desc( $id = '0' ) {
597
  return ( $order < '0' ) ? "DESC" : "";
598
  }
599
 
600
- function wppa_get_photo_order_column( $id = '0', $no_random = false ) {
 
601
  global $wpdb;
602
  global $wppa;
603
 
 
 
 
604
  // Random overrule?
605
  if ( wppa( 'is_random' ) ) {
606
  $result = 'random';
@@ -614,47 +618,31 @@ global $wppa;
614
 
615
  // No album specified
616
  else {
617
- $order = '0';
618
  }
619
 
620
- // No order yet? Use default
621
- if ( ! $order ) {
622
- $order = wppa_opt( 'list_photos_by' );
623
  }
624
 
625
  switch ( $order ) {
626
 
627
- case '1':
628
- case '-1':
629
- $result = 'p_order';
630
- break;
631
- case '2':
632
- case '-2':
633
- $result = 'name';
634
- break;
635
- case '3':
636
- case '-3':
637
- $result = 'random';
638
- break;
639
- case '4':
640
- case '-4':
641
- $result = 'mean_rating';
642
- break;
643
- case '5':
644
- case '-5':
645
- $result = 'timestamp';
646
- break;
647
- case '6':
648
- case '-6':
649
- $result = 'rating_count';
650
- break;
651
- case '7':
652
- case '-7':
653
- $result = 'exifdtm';
654
- break;
655
-
656
- default:
657
- $result = 'id';
658
  }
659
 
660
  return $result;
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.2.08
6
  *
7
  */
8
 
597
  return ( $order < '0' ) ? "DESC" : "";
598
  }
599
 
600
+ // Returns the columname for ORDER BY clause, DESC added where appliccable
601
+ function wppa_get_poc( $id = '0', $no_random = false ) {
602
  global $wpdb;
603
  global $wppa;
604
 
605
+ // Init
606
+ $order = '0';
607
+
608
  // Random overrule?
609
  if ( wppa( 'is_random' ) ) {
610
  $result = 'random';
618
 
619
  // No album specified
620
  else {
621
+ $order = wppa_opt( 'list_photos_by' );
622
  }
623
 
624
+ // If No random and is random so far, use default by id
625
+ if ( $no_random && ( $order == '3' || $order == '-3' ) ) {
626
+ $order = '0';
627
  }
628
 
629
  switch ( $order ) {
630
 
631
+ case '1': $result = 'p_order'; break;
632
+ case '-1': $result = 'p_order DESC'; break;
633
+ case '2': $result = 'name'; break;
634
+ case '-2': $result = 'name DESC'; break;
635
+ case '3': $result = 'random'; break;
636
+ case '-3': $result = 'random'; break;
637
+ case '4': $result = 'mean_rating'; break;
638
+ case '-4': $result = 'mean_rating DESC'; break;
639
+ case '5': $result = 'timestamp'; break;
640
+ case '-5': $result = 'timestamp DESC'; break;
641
+ case '6': $result = 'rating_count'; break;
642
+ case '-6': $result = 'rating_count DESC'; break;
643
+ case '7': $result = 'exifdtm'; break;
644
+ case '-7': $result = 'exifdtm DESC'; break;
645
+ default: $result = 'id';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
646
  }
647
 
648
  return $result;
wppa-filter.php CHANGED
@@ -131,7 +131,7 @@ global $wppa_revno;
131
  // Sanitize input
132
  if ( $atts['alt'] && $atss['alt'] != 'none' ) $atts['alt'] = strval( intval( $atts['alt'] ) );
133
  foreach ( array_keys( $atts ) as $key ) {
134
- $atts[$key] = strip_tags( $atts[$key] );
135
  }
136
 
137
  // Init
131
  // Sanitize input
132
  if ( $atts['alt'] && $atss['alt'] != 'none' ) $atts['alt'] = strval( intval( $atts['alt'] ) );
133
  foreach ( array_keys( $atts ) as $key ) {
134
+ $atts[$key] = strip_tags( $atts[$key] ); // NOT htmlspecialchars because of album="$cat,René" has allowed funny chars
135
  }
136
 
137
  // Init
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.2.06
7
  *
8
  */
9
 
@@ -157,7 +157,7 @@ global $wppa_session;
157
  if ( wppa( 'is_upldr' ) ) wppa( 'photos_only', true );
158
  wppa( 'is_owner', wppa_get_get( 'owner' ) );
159
  if ( wppa( 'is_owner' ) ) {
160
- $albs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
161
  WHERE owner = %s", wppa( 'is_owner' ) ), ARRAY_A );
162
  wppa_cache_album( 'add', $albs );
163
  $id = '';
@@ -235,8 +235,8 @@ global $wppa_session;
235
  return ''; // Do nothing on a landing page without a querystring while it is also not a search operation
236
  }
237
  elseif ( wppa( 'is_autopage' ) ) {
238
- $photo = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos
239
- WHERE page_id = %d
240
  LIMIT 1", wppa_get_the_id() ) );
241
  wppa( 'single_photo', $photo );
242
  if ( ! wppa( 'single_photo' ) ) {
@@ -291,25 +291,25 @@ global $wppa_session;
291
  if ( $limit ) {
292
  if ( $parent ) {
293
  if ( $limit ) {
294
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
295
- WHERE a_parent = %s
296
- ORDER BY timestamp DESC
297
  LIMIT %d", $parent, $limit );
298
  }
299
  else {
300
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
301
- WHERE a_parent = %s
302
  ORDER BY timestamp DESC", $parent );
303
  }
304
  }
305
  else {
306
  if ( $limit ) {
307
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
308
- ORDER BY timestamp DESC
309
  LIMIT %d", $limit );
310
  }
311
  else {
312
- $q = "SELECT * FROM $wpdb->wppa_albums
313
  ORDER BY timestamp DESC";
314
  }
315
  }
@@ -1089,25 +1089,25 @@ global $wppa_session;
1089
  }
1090
  elseif ( wppa( 'last_albums' ) ) { // is_cover = true. For the order sequence, see remark in wppa_albums()
1091
  if ( wppa( 'last_albums_parent' ) ) {
1092
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1093
- WHERE a_parent = %s
1094
- ORDER BY timestamp DESC
1095
  LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
1096
  }
1097
  else {
1098
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1099
- ORDER BY timestamp DESC
1100
  LIMIT %d", wppa( 'last_albums' ) );
1101
  }
1102
  $albums = $wpdb->get_results( $q, ARRAY_A );
1103
  }
1104
  elseif ( wppa_is_int( $id ) ) {
1105
  if ( wppa( 'is_cover' ) ) {
1106
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1107
  WHERE id = %d", $id );
1108
  }
1109
  else {
1110
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1111
  WHERE a_parent = %d " . wppa_get_album_order( $id ), $id );
1112
  }
1113
  $albums = $wpdb->get_results( $q, ARRAY_A );
@@ -1115,11 +1115,11 @@ global $wppa_session;
1115
  elseif ( strpos( $id, '.' ) !== false ) { // Album enum
1116
  $ids = wppa_series_to_array( $id );
1117
  if ( wppa( 'is_cover' ) ) {
1118
- $q = "SELECT * FROM $wpdb->wppa_albums
1119
  WHERE id = " . implode( " OR id = ", $ids ) . " " . wppa_get_album_order();
1120
  }
1121
  else {
1122
- $q = "SELECT * FROM $wpdb->wppa_albums
1123
  WHERE a_parent = " . implode( " OR a_parent = ", $ids ) . " " . wppa_get_album_order();
1124
  }
1125
  wppa_dbg_msg( $q, 'red' );
@@ -1288,7 +1288,7 @@ global $wppa_session;
1288
  $max = wppa( 'featen_count' );
1289
 
1290
  $query = "SELECT * FROM $wpdb->wppa_photos
1291
- WHERE $album_clause
1292
  AND status = 'featured'
1293
  ORDER BY RAND( " . wppa_get_randseed() . " )
1294
  LIMIT $max";
@@ -1410,31 +1410,32 @@ global $wppa_session;
1410
  if ( ! $first ) {
1411
  $tags_like .= " " . $andor;
1412
  }
1413
- $tags_like .= " tags LIKE '%,".$tag.",%'";
1414
  $first = false;
1415
  }
1416
 
 
1417
  // Album spec?
1418
  if ( wppa( 'start_album' ) ) {
1419
  $fac = ' AND ' . $album_clause . ' ';
1420
  }
1421
  else {
1422
- $fac = " AND album > '0' ";
1423
  }
1424
-
1425
  // Prepare the query
1426
  if ( current_user_can( 'wppa_moderate' ) ) {
1427
  $query = "SELECT * FROM $wpdb->wppa_photos
1428
  WHERE ( $tags_like )
1429
- AND $album_clause " .
1430
- wppa_get_photo_order( '0' );
1431
  }
1432
  else {
1433
  $query = "SELECT * FROM $wpdb->wppa_photos
1434
  WHERE ( $tags_like )
1435
  AND $album_clause
1436
- AND $status " .
1437
- wppa_get_photo_order( '0' );
1438
  }
1439
  }
1440
 
@@ -1465,17 +1466,18 @@ global $wppa_session;
1465
  }
1466
  if ( current_user_can( 'wppa_moderate' ) ) {
1467
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1468
- WHERE name " . $is . " %s
1469
- AND album > '0' " .
1470
- wppa_get_photo_order( '0' ), $data );
1471
  }
1472
  else {
1473
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1474
- WHERE name " . $is . " %s
1475
- AND album > '0'
1476
- AND " . $status . " " .
1477
- wppa_get_photo_order( '0' ), $data );
1478
  }
 
1479
  break;
1480
 
1481
  // Owner
@@ -1483,15 +1485,15 @@ global $wppa_session;
1483
  if ( current_user_can( 'wppa_moderate' ) ) {
1484
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1485
  WHERE owner = %s
1486
- AND album > '0' " .
1487
- wppa_get_photo_order( '0' ), $data );
1488
  }
1489
  else {
1490
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1491
  WHERE owner = %s
1492
- AND album > '0'
1493
- AND " . $status . " " .
1494
- wppa_get_photo_order( '0' ), $data );
1495
  }
1496
  break;
1497
 
@@ -1512,9 +1514,10 @@ global $wppa_session;
1512
  }
1513
  if ( count( $tagids ) > '0' ) {
1514
  $query = "SELECT * FROM $wpdb->wppa_photos
1515
- WHERE " . $status . "
1516
  AND id IN (" . implode( ',',$tagids ) . ")
1517
- AND album > '0' ";
 
1518
  }
1519
  break;
1520
 
@@ -1533,7 +1536,7 @@ global $wppa_session;
1533
  }
1534
  }
1535
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1536
- WHERE slug " . $is . " %s", $temp['0'] );
1537
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1538
  $ids = array();
1539
  foreach( $indexes as $item ) {
@@ -1550,7 +1553,7 @@ global $wppa_session;
1550
  }
1551
 
1552
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1553
- WHERE slug " . $is . " %s", $temp[$i] );
1554
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1555
  $deltaids = array();
1556
  foreach( $indexes as $item ) {
@@ -1570,7 +1573,7 @@ global $wppa_session;
1570
  }
1571
  }
1572
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1573
- WHERE slug " . $is . " %s", $data );
1574
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1575
  $ids = array();
1576
  foreach( $indexes as $item ) {
@@ -1581,9 +1584,10 @@ global $wppa_session;
1581
  $ids = array( '0' ); // Dummy
1582
  }
1583
  $query = "SELECT * FROM $wpdb->wppa_photos
1584
- WHERE " . $status . "
1585
- AND album > '0'
1586
- AND id IN (" . trim( implode( ',', $ids ), ',' ) . ")";
 
1587
  break;
1588
 
1589
  // Iptc
@@ -1599,9 +1603,10 @@ global $wppa_session;
1599
  $ids .= ','.$item['photo'];
1600
  }
1601
  $query = "SELECT * FROM $wpdb->wppa_photos
1602
- WHERE " . $status . "
1603
  AND album > '0'
1604
- AND id IN (" . $ids . ")";
 
1605
  break;
1606
 
1607
  // Exif
@@ -1619,9 +1624,10 @@ global $wppa_session;
1619
  $ids .= ',' . $item['photo'];
1620
  }
1621
  $query = "SELECT * FROM $wpdb->wppa_photos
1622
- WHERE " . $status . "
1623
- AND album > '0'
1624
- AND id IN (" . $ids . ")";
 
1625
  break;
1626
 
1627
  default:
@@ -1643,9 +1649,9 @@ global $wppa_session;
1643
 
1644
  // Remove scheduled and pending and trashed when not can moderate
1645
  if ( ! current_user_can( 'wppa_moderate' ) ) {
1646
- $needmod = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos
1647
- WHERE status = 'scheduled'
1648
- OR status = 'pending'
1649
  OR album <= '-9'" );
1650
  if ( is_array( $needmod ) ) {
1651
  $final_array = array_diff( $final_array, $needmod );
@@ -1654,7 +1660,7 @@ global $wppa_session;
1654
 
1655
  // Remove private and trashed when not logged in
1656
  if ( ! is_user_logged_in() ) {
1657
- $needlogin = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos
1658
  WHERE status = 'private' OR album <= '-9'" );
1659
  if ( is_array( $needlogin ) ) {
1660
  $final_array = array_diff( $final_array, $needlogin );
@@ -1685,7 +1691,7 @@ global $wppa_session;
1685
  // Maybe cats limitation
1686
  elseif ( wppa( 'catbox' ) ) {
1687
 
1688
- $catalbs = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums
1689
  WHERE cats LIKE '%" . wppa( 'catbox' ) . "%' " );
1690
 
1691
  if ( ! empty( $catalbs ) ) {
@@ -1699,7 +1705,7 @@ global $wppa_session;
1699
  // exclude separate if required
1700
  elseif ( ! $alb_clause && wppa_switch( 'excl_sep' ) ) {
1701
  $sep_albs = '';
1702
- $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
1703
  WHERE a_parent = '-1'", ARRAY_A );
1704
  if ( ! empty( $temp ) ) {
1705
  $t = array();
@@ -1732,10 +1738,10 @@ global $wppa_session;
1732
  }
1733
 
1734
  // Construct the query
1735
- $query = "SELECT * FROM $wpdb->wppa_photos
1736
- WHERE " . $selection .
1737
- $alb_clause .
1738
- wppa_get_photo_order( '0' ) .
1739
  $limit;
1740
  }
1741
 
@@ -1751,10 +1757,10 @@ global $wppa_session;
1751
  switch ( wppa( 'calendar' ) ) {
1752
  case 'exifdtm':
1753
  $query = "SELECT * FROM $wpdb->wppa_photos
1754
- WHERE exifdtm LIKE '" . strip_tags( wppa( 'caldate' ) ) . "%'
1755
- AND status <> 'pending'
1756
  AND status <> 'scheduled' " .
1757
- $alb_clause .
1758
  $order;
1759
  break;
1760
 
@@ -1762,23 +1768,23 @@ global $wppa_session;
1762
  $t1 = strval( intval( wppa( 'caldate' ) * 24*60*60 ) );
1763
  $t2 = $t1 + 24*60*60;
1764
  $query = "SELECT * FROM $wpdb->wppa_photos
1765
- WHERE timestamp >= $t1
1766
- AND timestamp < $t2
1767
- AND status <> 'pending'
1768
- AND status <> 'scheduled' " .
1769
- $alb_clause .
1770
  $order;
1771
  break;
1772
 
1773
  case 'modified':
1774
  $t1 = strval( intval( wppa( 'caldate' ) * 24*60*60 ) );
1775
  $t2 = $t1 + 24*60*60;
1776
- $query = "SELECT * FROM $wpdb->wppa_photos
1777
- WHERE modified >= $t1
1778
- AND modified < $t2
1779
- AND status <> 'pending'
1780
- AND status <> 'scheduled' " .
1781
- $alb_clause .
1782
  $order;
1783
  break;
1784
 
@@ -1814,7 +1820,7 @@ global $wppa_session;
1814
  }
1815
  else {
1816
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1817
- WHERE ( ( " . $status . " )
1818
  OR owner = %s )
1819
  AND album > '0' " .
1820
  wppa_get_photo_order( '0' ) .
@@ -1826,15 +1832,15 @@ global $wppa_session;
1826
  // Single album ?
1827
  elseif ( wppa_is_int( wppa( 'start_album' ) ) ) {
1828
  if ( current_user_can( 'wppa_moderate' ) ) {
1829
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1830
  WHERE album = %d " .
1831
  wppa_get_photo_order( wppa( 'start_album' ) ) .
1832
  $lim, wppa( 'start_album' ) );
1833
  }
1834
  else {
1835
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1836
- WHERE ( ( " . $status . " )
1837
- OR owner = %s )
1838
  AND album = %d " .
1839
  wppa_get_photo_order( wppa( 'start_album' ) ) .
1840
  $lim,
@@ -1853,8 +1859,8 @@ global $wppa_session;
1853
  }
1854
  else {
1855
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1856
- WHERE ( ( " . $status . " )
1857
- OR owner = %s )
1858
  AND " . $wherealbum . " " .
1859
  wppa_get_photo_order( '0' ) .
1860
  $lim,
@@ -1924,12 +1930,16 @@ global $wpdb;
1924
  // Trim searchword to a max of 20 chars
1925
  if ( strlen( $word ) > 20 ) $word = substr( $word, 0, 20 );
1926
 
1927
- /* hbi */ // Floating searchtoken?
1928
  if ( wppa_switch( 'wild_front' ) ) {
1929
- $idxs = $wpdb->get_col( "SELECT " . $type . " FROM $wpdb->wppa_index WHERE slug LIKE '%" . $word . "%'" );
 
 
1930
  }
1931
  else {
1932
- $idxs = $wpdb->get_col( "SELECT " . $type . " FROM $wpdb->wppa_index WHERE slug LIKE '" . $word . "%'" );
 
 
1933
  }
1934
 
1935
  // $item_array is an array of arrays with item ids per word.
@@ -1964,10 +1974,14 @@ global $wpdb;
1964
 
1965
  // Floating searchtoken?
1966
  if ( wppa_switch( 'wild_front' ) ) {
1967
- $idxs = $wpdb->get_col( "SELECT " . $type . " FROM $wpdb->wppa_index WHERE slug LIKE '%" . $word . "%'" );
 
 
1968
  }
1969
  else {
1970
- $idxs = $wpdb->get_col( "SELECT " . $type . " FROM $wpdb->wppa_index WHERE slug LIKE '" . $word . "%'" );
 
 
1971
  }
1972
 
1973
  // Find ids to exclude for the current !word
@@ -1982,7 +1996,7 @@ global $wpdb;
1982
  }
1983
  }
1984
 
1985
- // All words and not wrds of this chunk processed, remove not_array from item_array
1986
  if ( ! empty( $not_item_array ) ) {
1987
  $item_array[0] = array_diff( $item_array[0], $not_item_array );
1988
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 7.2.08
7
  *
8
  */
9
 
157
  if ( wppa( 'is_upldr' ) ) wppa( 'photos_only', true );
158
  wppa( 'is_owner', wppa_get_get( 'owner' ) );
159
  if ( wppa( 'is_owner' ) ) {
160
+ $albs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
161
  WHERE owner = %s", wppa( 'is_owner' ) ), ARRAY_A );
162
  wppa_cache_album( 'add', $albs );
163
  $id = '';
235
  return ''; // Do nothing on a landing page without a querystring while it is also not a search operation
236
  }
237
  elseif ( wppa( 'is_autopage' ) ) {
238
+ $photo = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos
239
+ WHERE page_id = %d
240
  LIMIT 1", wppa_get_the_id() ) );
241
  wppa( 'single_photo', $photo );
242
  if ( ! wppa( 'single_photo' ) ) {
291
  if ( $limit ) {
292
  if ( $parent ) {
293
  if ( $limit ) {
294
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
295
+ WHERE a_parent = %s
296
+ ORDER BY timestamp DESC
297
  LIMIT %d", $parent, $limit );
298
  }
299
  else {
300
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
301
+ WHERE a_parent = %s
302
  ORDER BY timestamp DESC", $parent );
303
  }
304
  }
305
  else {
306
  if ( $limit ) {
307
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
308
+ ORDER BY timestamp DESC
309
  LIMIT %d", $limit );
310
  }
311
  else {
312
+ $q = "SELECT * FROM $wpdb->wppa_albums
313
  ORDER BY timestamp DESC";
314
  }
315
  }
1089
  }
1090
  elseif ( wppa( 'last_albums' ) ) { // is_cover = true. For the order sequence, see remark in wppa_albums()
1091
  if ( wppa( 'last_albums_parent' ) ) {
1092
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1093
+ WHERE a_parent = %s
1094
+ ORDER BY timestamp DESC
1095
  LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
1096
  }
1097
  else {
1098
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1099
+ ORDER BY timestamp DESC
1100
  LIMIT %d", wppa( 'last_albums' ) );
1101
  }
1102
  $albums = $wpdb->get_results( $q, ARRAY_A );
1103
  }
1104
  elseif ( wppa_is_int( $id ) ) {
1105
  if ( wppa( 'is_cover' ) ) {
1106
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1107
  WHERE id = %d", $id );
1108
  }
1109
  else {
1110
+ $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums
1111
  WHERE a_parent = %d " . wppa_get_album_order( $id ), $id );
1112
  }
1113
  $albums = $wpdb->get_results( $q, ARRAY_A );
1115
  elseif ( strpos( $id, '.' ) !== false ) { // Album enum
1116
  $ids = wppa_series_to_array( $id );
1117
  if ( wppa( 'is_cover' ) ) {
1118
+ $q = "SELECT * FROM $wpdb->wppa_albums
1119
  WHERE id = " . implode( " OR id = ", $ids ) . " " . wppa_get_album_order();
1120
  }
1121
  else {
1122
+ $q = "SELECT * FROM $wpdb->wppa_albums
1123
  WHERE a_parent = " . implode( " OR a_parent = ", $ids ) . " " . wppa_get_album_order();
1124
  }
1125
  wppa_dbg_msg( $q, 'red' );
1288
  $max = wppa( 'featen_count' );
1289
 
1290
  $query = "SELECT * FROM $wpdb->wppa_photos
1291
+ WHERE $album_clause
1292
  AND status = 'featured'
1293
  ORDER BY RAND( " . wppa_get_randseed() . " )
1294
  LIMIT $max";
1410
  if ( ! $first ) {
1411
  $tags_like .= " " . $andor;
1412
  }
1413
+ $tags_like .= " tags LIKE '%,".$wpdb->esc_like($tag).",%'";
1414
  $first = false;
1415
  }
1416
 
1417
+ /* Looks useless *
1418
  // Album spec?
1419
  if ( wppa( 'start_album' ) ) {
1420
  $fac = ' AND ' . $album_clause . ' ';
1421
  }
1422
  else {
1423
+ $fac = " AND album > 0";
1424
  }
1425
+ */
1426
  // Prepare the query
1427
  if ( current_user_can( 'wppa_moderate' ) ) {
1428
  $query = "SELECT * FROM $wpdb->wppa_photos
1429
  WHERE ( $tags_like )
1430
+ AND $album_clause
1431
+ ORDER BY " . wppa_get_poc( '0' );
1432
  }
1433
  else {
1434
  $query = "SELECT * FROM $wpdb->wppa_photos
1435
  WHERE ( $tags_like )
1436
  AND $album_clause
1437
+ AND $status
1438
+ ORDER BY " . wppa_get_poc( '0' );
1439
  }
1440
  }
1441
 
1466
  }
1467
  if ( current_user_can( 'wppa_moderate' ) ) {
1468
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1469
+ WHERE name $is %s
1470
+ AND album > 0
1471
+ ORDER BY " . wppa_get_poc(), $data );
1472
  }
1473
  else {
1474
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1475
+ WHERE name $is %s
1476
+ AND album > 0
1477
+ AND $status
1478
+ ORDER BY " . wppa_get_poc(), $data );
1479
  }
1480
+
1481
  break;
1482
 
1483
  // Owner
1485
  if ( current_user_can( 'wppa_moderate' ) ) {
1486
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1487
  WHERE owner = %s
1488
+ AND album > 0
1489
+ ORDER BY " . wppa_get_poc(), $data );
1490
  }
1491
  else {
1492
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1493
  WHERE owner = %s
1494
+ AND album > 0
1495
+ AND $status
1496
+ ORDER BY " . wppa_get_poc(), $data );
1497
  }
1498
  break;
1499
 
1514
  }
1515
  if ( count( $tagids ) > '0' ) {
1516
  $query = "SELECT * FROM $wpdb->wppa_photos
1517
+ WHERE $status
1518
  AND id IN (" . implode( ',',$tagids ) . ")
1519
+ AND album > 0
1520
+ ORDER BY " . wppa_get_poc();
1521
  }
1522
  break;
1523
 
1536
  }
1537
  }
1538
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1539
+ WHERE slug $is %s", $temp['0'] );
1540
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1541
  $ids = array();
1542
  foreach( $indexes as $item ) {
1553
  }
1554
 
1555
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1556
+ WHERE slug $is %s", $temp[$i] );
1557
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1558
  $deltaids = array();
1559
  foreach( $indexes as $item ) {
1573
  }
1574
  }
1575
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index
1576
+ WHERE slug $is %s", $data );
1577
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1578
  $ids = array();
1579
  foreach( $indexes as $item ) {
1584
  $ids = array( '0' ); // Dummy
1585
  }
1586
  $query = "SELECT * FROM $wpdb->wppa_photos
1587
+ WHERE $status
1588
+ AND album > 0
1589
+ AND id IN (" . trim( implode( ',', $ids ), ',' ) . ")
1590
+ ORDER BY " . wppa_get_poc();
1591
  break;
1592
 
1593
  // Iptc
1603
  $ids .= ','.$item['photo'];
1604
  }
1605
  $query = "SELECT * FROM $wpdb->wppa_photos
1606
+ WHERE $status
1607
  AND album > '0'
1608
+ AND id IN (" . $ids . ")
1609
+ ORDER BY " . wppa_get_poc();
1610
  break;
1611
 
1612
  // Exif
1624
  $ids .= ',' . $item['photo'];
1625
  }
1626
  $query = "SELECT * FROM $wpdb->wppa_photos
1627
+ WHERE $status
1628
+ AND album > 0
1629
+ AND id IN (" . $ids . ")
1630
+ ORDER BY " . wppa_get_poc();
1631
  break;
1632
 
1633
  default:
1649
 
1650
  // Remove scheduled and pending and trashed when not can moderate
1651
  if ( ! current_user_can( 'wppa_moderate' ) ) {
1652
+ $needmod = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos
1653
+ WHERE status = 'scheduled'
1654
+ OR status = 'pending'
1655
  OR album <= '-9'" );
1656
  if ( is_array( $needmod ) ) {
1657
  $final_array = array_diff( $final_array, $needmod );
1660
 
1661
  // Remove private and trashed when not logged in
1662
  if ( ! is_user_logged_in() ) {
1663
+ $needlogin = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos
1664
  WHERE status = 'private' OR album <= '-9'" );
1665
  if ( is_array( $needlogin ) ) {
1666
  $final_array = array_diff( $final_array, $needlogin );
1691
  // Maybe cats limitation
1692
  elseif ( wppa( 'catbox' ) ) {
1693
 
1694
+ $catalbs = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums
1695
  WHERE cats LIKE '%" . wppa( 'catbox' ) . "%' " );
1696
 
1697
  if ( ! empty( $catalbs ) ) {
1705
  // exclude separate if required
1706
  elseif ( ! $alb_clause && wppa_switch( 'excl_sep' ) ) {
1707
  $sep_albs = '';
1708
+ $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums
1709
  WHERE a_parent = '-1'", ARRAY_A );
1710
  if ( ! empty( $temp ) ) {
1711
  $t = array();
1738
  }
1739
 
1740
  // Construct the query
1741
+ $query = "SELECT * FROM $wpdb->wppa_photos
1742
+ WHERE " . $selection .
1743
+ $alb_clause .
1744
+ wppa_get_photo_order( '0' ) .
1745
  $limit;
1746
  }
1747
 
1757
  switch ( wppa( 'calendar' ) ) {
1758
  case 'exifdtm':
1759
  $query = "SELECT * FROM $wpdb->wppa_photos
1760
+ WHERE exifdtm LIKE '" . strip_tags( wppa( 'caldate' ) ) . "%'
1761
+ AND status <> 'pending'
1762
  AND status <> 'scheduled' " .
1763
+ $alb_clause .
1764
  $order;
1765
  break;
1766
 
1768
  $t1 = strval( intval( wppa( 'caldate' ) * 24*60*60 ) );
1769
  $t2 = $t1 + 24*60*60;
1770
  $query = "SELECT * FROM $wpdb->wppa_photos
1771
+ WHERE timestamp >= $t1
1772
+ AND timestamp < $t2
1773
+ AND status <> 'pending'
1774
+ AND status <> 'scheduled' " .
1775
+ $alb_clause .
1776
  $order;
1777
  break;
1778
 
1779
  case 'modified':
1780
  $t1 = strval( intval( wppa( 'caldate' ) * 24*60*60 ) );
1781
  $t2 = $t1 + 24*60*60;
1782
+ $query = "SELECT * FROM $wpdb->wppa_photos
1783
+ WHERE modified >= $t1
1784
+ AND modified < $t2
1785
+ AND status <> 'pending'
1786
+ AND status <> 'scheduled' " .
1787
+ $alb_clause .
1788
  $order;
1789
  break;
1790
 
1820
  }
1821
  else {
1822
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1823
+ WHERE ( ( " . $status . " )
1824
  OR owner = %s )
1825
  AND album > '0' " .
1826
  wppa_get_photo_order( '0' ) .
1832
  // Single album ?
1833
  elseif ( wppa_is_int( wppa( 'start_album' ) ) ) {
1834
  if ( current_user_can( 'wppa_moderate' ) ) {
1835
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1836
  WHERE album = %d " .
1837
  wppa_get_photo_order( wppa( 'start_album' ) ) .
1838
  $lim, wppa( 'start_album' ) );
1839
  }
1840
  else {
1841
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1842
+ WHERE ( ( " . $status . " )
1843
+ OR owner = %s )
1844
  AND album = %d " .
1845
  wppa_get_photo_order( wppa( 'start_album' ) ) .
1846
  $lim,
1859
  }
1860
  else {
1861
  $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1862
+ WHERE ( ( " . $status . " )
1863
+ OR owner = %s )
1864
  AND " . $wherealbum . " " .
1865
  wppa_get_photo_order( '0' ) .
1866
  $lim,
1930
  // Trim searchword to a max of 20 chars
1931
  if ( strlen( $word ) > 20 ) $word = substr( $word, 0, 20 );
1932
 
1933
+ // Floating searchtoken?
1934
  if ( wppa_switch( 'wild_front' ) ) {
1935
+ $idxs = $wpdb->get_col( $wpdb->prepare( "SELECT $type
1936
+ FROM $wpdb->wppa_index
1937
+ WHERE slug LIKE %s", '%' . $wpdb->esc_like( $word ) . '%' ) );
1938
  }
1939
  else {
1940
+ $idxs = $wpdb->get_col( $wpdb->prepare( "SELECT $type
1941
+ FROM $wpdb->wppa_index
1942
+ WHERE slug LIKE %s", $wpdb->esc_like( $word ) . '%' ) );
1943
  }
1944
 
1945
  // $item_array is an array of arrays with item ids per word.
1974
 
1975
  // Floating searchtoken?
1976
  if ( wppa_switch( 'wild_front' ) ) {
1977
+ $idxs = $wpdb->get_col( $wpdb->prepare( "SELECT $type
1978
+ FROM $wpdb->wppa_index
1979
+ WHERE slug LIKE %s", '%' . $wpdb->esc_like( $word ) . '%' ) );
1980
  }
1981
  else {
1982
+ $idxs = $wpdb->get_col( $wpdb->prepare( "SELECT $type
1983
+ FROM $wpdb->wppa_index
1984
+ WHERE slug LIKE %s", $wpdb->esc_like( $word ) . '%' ) );
1985
  }
1986
 
1987
  // Find ids to exclude for the current !word
1996
  }
1997
  }
1998
 
1999
+ // All words and not words of this chunk processed, remove not_array from item_array
2000
  if ( ! empty( $not_item_array ) ) {
2001
  $item_array[0] = array_diff( $item_array[0], $not_item_array );
2002
  }
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.2.08.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/
@@ -23,7 +23,7 @@ global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7208'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.2.08.003'; // WPPA software version
27
 
28
  /* Init page js data */
29
  global $wppa_js_page_data; $wppa_js_page_data = '';
2
  /*
3
  * Plugin Name: WP Photo Album Plus
4
  * Description: Easily manage and display your photo albums and slideshows within your WordPress site.
5
+ * Version: 7.2.08.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
 
24
  /* WPPA GLOBALS */
25
  global $wppa_revno; $wppa_revno = '7208'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.2.08.004'; // WPPA software version
27
 
28
  /* Init page js data */
29
  global $wppa_js_page_data; $wppa_js_page_data = '';