WP Photo Album Plus - Version 7.2.07.006

Version Description

= 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.07.006
Comparing to
See all releases

Code changes from version 7.2.06.009 to 7.2.07.006

changelog.txt CHANGED
@@ -1,5 +1,13 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
3
  = 7.2.06 =
4
 
5
  * Fixed a few issues with user display names with accented characters.
1
  WP Photo Album Plus Changelog
2
 
3
+ = 7.2.07 =
4
+
5
+ * Various security and code quality issues fixed.
6
+ * Table IX-E22: Placeholder text for the search photos box/widget is believed to work in all configurations now.
7
+ * The zipfile name of the album download is now always sanitized and no longer dependant of Table IX-D17.
8
+ This fixes possible 404 errors on album downloads when the album name had funny characters like " in its name.
9
+ * One could not have more than one multitag/tags-filter instance on a page. Fixed.
10
+
11
  = 7.2.06 =
12
 
13
  * Fixed a few issues with user display names with accented characters.
readme.txt CHANGED
@@ -2,8 +2,8 @@
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.06.009
6
- Stable tag: 7.2.05.008
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
@@ -137,6 +137,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
137
 
138
  == Upgrade Notice ==
139
 
 
 
 
 
140
  = 7.2.06 =
141
 
142
  * This version addresses various bug fixes and feature requests.
2
  Contributors: opajaap
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=OpaJaap@OpaJaap.nl&item_name=WP-Photo-Album-Plus&item_number=Support-Open-Source&currency_code=USD&lc=US
4
  Tags: photo, album, slideshow, video, audio, lightbox, iptc, exif, cloudinary, fotomoto, imagemagick, pdf
5
+ Version: 7.2.07.006
6
+ Stable tag: 7.2.06.009
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
9
  Requires at least: 3.9
137
 
138
  == Upgrade Notice ==
139
 
140
+ = 7.2.07 =
141
+
142
+ * This version addresses various bug fixes.
143
+
144
  = 7.2.06 =
145
 
146
  * This version addresses various bug fixes and feature requests.
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 7.2.06
6
  *
7
  */
8
 
@@ -637,7 +637,7 @@ global $wppa_log_file;
637
  wppa_exit();
638
  }
639
  $zipfilename = wppa_get_album_name( $alb );
640
- $zipfilename = wppa_sanitize_file_name( $zipfilename . '.zip' ); // Remove illegal chars
641
  $zipfilepath = WPPA_UPLOAD_PATH . '/temp/' . $zipfilename;
642
  // if ( is_file( $zipfilepath ) ) {
643
  // unlink( $zipfilepath ); // Debug
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 7.2.07
6
  *
7
  */
8
 
637
  wppa_exit();
638
  }
639
  $zipfilename = wppa_get_album_name( $alb );
640
+ $zipfilename = sanitize_file_name( $zipfilename . '.zip' ); // Remove illegal chars
641
  $zipfilepath = WPPA_UPLOAD_PATH . '/temp/' . $zipfilename;
642
  // if ( is_file( $zipfilepath ) ) {
643
  // unlink( $zipfilepath ); // Debug
wppa-boxes-html.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
- * Version 7.2.06
7
  *
8
  */
9
 
@@ -317,7 +317,7 @@ global $wppa_session;
317
  $form_core = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
318
  <label>
319
  <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
320
- <input type="search" class="search-field" placeholder="' . esc_attr_x( 'Search &hellip;', 'placeholder' ) . '" value="' . get_search_query() . '" name="s" />
321
  </label>
322
  <input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
323
  </form>';
@@ -340,6 +340,13 @@ global $wppa_session;
340
  $form_core = str_replace( 'id="s"', 'id="wppa_s-'.$mocc.'"', $form_core );
341
  $form_core = str_replace( 'name="s"', 'name="wppa-searchstring"', $form_core );
342
 
 
 
 
 
 
 
 
343
  // Fix previous input
344
  $form_core = str_replace( 'value=""', 'value="' . esc_attr( isset( $_REQUEST['wppa-searchstring'] ) ? $_REQUEST['wppa-searchstring'] : '' ) . '"', $form_core );
345
 
@@ -471,15 +478,20 @@ global $wppa_supported_camara_brands;
471
  }
472
  $ss_data['3'] = str_replace( '***', '...', $ss_data['3'] );
473
 
474
- $query = "SELECT slug FROM $wpdb->wppa_index WHERE albums <> '' ORDER BY slug";
 
 
475
  $albumtxt = $wpdb->get_results( $query, ARRAY_A );
476
- $query = "SELECT slug FROM $wpdb->wppa_index WHERE photos <> '' ORDER BY slug";
 
 
477
  $phototxt = $wpdb->get_results( $query, ARRAY_A );
478
 
479
  // IPTC
480
  $iptclist = wppa_switch( 'save_iptc' ) ?
481
  $wpdb->get_results( "SELECT tag, description FROM $wpdb->wppa_iptc
482
- WHERE photo = '0' AND status <> 'hide'", ARRAY_A ) : array();
 
483
 
484
  // Translate (for multilanguage qTranslate-able labels )
485
  if ( ! empty( $iptclist ) ) {
@@ -494,22 +506,13 @@ global $wppa_supported_camara_brands;
494
  // EXIF
495
  $exiflist = wppa_switch( 'save_exif' ) ?
496
  $wpdb->get_results( "SELECT tag, description, status FROM $wpdb->wppa_exif
497
- WHERE photo = '0' AND status <> 'hide'", ARRAY_A ) : array();
 
498
 
499
  // Translate (for multilanguage qTranslate-able labels), // or remove if no non-empty items
500
- //echo serialize($exiflist);
501
  if ( ! empty( $exiflist ) ) {
502
  foreach( array_keys( $exiflist ) as $idx ) {
503
- // $exists = $wpdb->get_var( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif " .
504
- // "WHERE photo <> '0' " .
505
- // "AND tag = %s " .
506
- // "AND description <> '' LIMIT 1", $exiflist[$idx]['tag'] ) );
507
- // if ( ! $exists ) {
508
- // unset( $exiflist[$idx] );
509
- // }
510
- // else {
511
- $exiflist[$idx]['description'] = __( $exiflist[$idx]['description'] );
512
- // }
513
  }
514
  }
515
 
@@ -1324,7 +1327,7 @@ function wppa_get_multitag_html( $nperline = '2', $seltags = '' ) {
1324
 
1325
  $result .= '
1326
  <script type="text/javascript" >
1327
- function wppaProcessMultiTagRequest() {
1328
  var any = false;
1329
  var url="' . wppa_encrypt_url( $hr ) . '";';
1330
 
@@ -1354,7 +1357,7 @@ function wppa_get_multitag_html( $nperline = '2', $seltags = '' ) {
1354
  if ( $tags ) foreach ( $tags as $tag ) {
1355
  if ( ! $seltags || in_array( $tag['tag'], $selarr ) ) {
1356
  $result .= '
1357
- if ( document.getElementById( "wppa-'.str_replace( ' ', '_', $tag['tag']).'" ).checked ) {' .
1358
  'url+="'.urlencode($tag['tag']).'"+sep;' .
1359
  'any = true;
1360
  }';
@@ -1449,7 +1452,7 @@ function wppa_get_multitag_html( $nperline = '2', $seltags = '' ) {
1449
  ' >' .
1450
  '<input' .
1451
  ' type="checkbox"' .
1452
- ' id="wppa-'.str_replace( ' ', '_', $tag['tag'] ).'"' .
1453
  ' ' . $checked .
1454
  ' />' .
1455
  '&nbsp;' . str_replace( ' ', '&nbsp;', __( $tag['tag'] ) ) .
@@ -1472,7 +1475,7 @@ function wppa_get_multitag_html( $nperline = '2', $seltags = '' ) {
1472
  $result .= '</table>';
1473
  $result .= '<input' .
1474
  ' type="button"' .
1475
- ' onclick="wppaProcessMultiTagRequest()"' .
1476
  ' value="' . __( 'Find!', 'wp-photo-album-plus' ) . '"' .
1477
  ' />';
1478
  }
@@ -1835,10 +1838,12 @@ global $wpdb;
1835
  $share_url = wppa_convert_to_pretty( get_permalink( $p ) );
1836
 
1837
  // The share title
1838
- $share_name = $wpdb->get_var( "SELECT post_title FROM " . $wpdb->prefix . 'posts' . " WHERE ID = " . $p );
 
1839
 
1840
  // The share description
1841
- $share_desc = $wpdb->get_var( "SELECT post_content FROM " . $wpdb->prefix . 'posts' . " WHERE ID = " . $p );
 
1842
  $share_desc = strip_tags( strip_shortcodes( $share_desc ) );
1843
  if ( strlen( $share_desc ) > 150 ) {
1844
  $share_desc = substr( $share_desc, 0, 120 ) . '...';
@@ -2458,9 +2463,8 @@ static $albums_granted;
2458
 
2459
  // Login not required, but there are no public albums while user not logged in?
2460
  elseif ( ! is_user_logged_in() ) {
2461
- $public_exist = $wpdb->get_var( "SELECT COUNT(*) " .
2462
- "FROM $wpdb->wppa_albums " .
2463
- "WHERE owner = '--- public ---' " );
2464
 
2465
  if ( ! $public_exist ) {
2466
  return '';
@@ -3546,8 +3550,16 @@ global $wpdb;
3546
 
3547
  // Loop the comments already there
3548
  $n_comments = 0;
3549
- if ( wppa_switch( 'comments_desc' ) ) $ord = 'DESC'; else $ord = '';
3550
- $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments WHERE photo = %d ORDER BY id ".$ord, $id ), ARRAY_A );
 
 
 
 
 
 
 
 
3551
  $com_count = count( $comments );
3552
  $color = 'darkgrey';
3553
  if ( wppa_opt( 'fontcolor_box' ) ) $color = wppa_opt( 'fontcolor_box' );
@@ -3622,7 +3634,8 @@ global $wpdb;
3622
 
3623
  // Still no user, try to find him by display name
3624
  if ( ! $usr ) {
3625
- $usr = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users WHERE display_name = %s", $comment['user'] ) );
 
3626
 
3627
  // Accept this user if he is the only one with this display name
3628
  if ( count( $usr ) != 1 ) {
@@ -3962,7 +3975,9 @@ global $wppa_iptc_cache;
3962
 
3963
  // Get tha labels if not yet present
3964
  if ( ! is_array( $wppa_iptc_labels ) ) {
3965
- $wppa_iptc_labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_iptc WHERE photo = '0' ORDER BY tag", ARRAY_A );
 
 
3966
  }
3967
 
3968
  $count = 0;
@@ -3977,7 +3992,9 @@ global $wppa_iptc_cache;
3977
 
3978
  // Get the photo data
3979
  if ( $iptcdata === false ) {
3980
- $iptcdata = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_iptc WHERE photo=%s ORDER BY tag", $photo ), ARRAY_A );
 
 
3981
 
3982
  // Save in cache, even when empty
3983
  $wppa_iptc_cache[$photo] = $iptcdata;
@@ -4075,7 +4092,9 @@ global $wppa_exif_cache;
4075
 
4076
  // Get tha labels if not yet present
4077
  if ( ! is_array( $wppa_exif_labels ) ) {
4078
- $wppa_exif_labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_exif WHERE photo = '0' ORDER BY tag", ARRAY_A );
 
 
4079
  }
4080
 
4081
  $count = 0;
@@ -4092,7 +4111,9 @@ global $wppa_exif_cache;
4092
 
4093
  // Get the photo data
4094
  if ( $exifdata === false ) {
4095
- $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif WHERE photo = %s ORDER BY tag", $photo ), ARRAY_A );
 
 
4096
 
4097
  // Save in cache, even when empty
4098
  $wppa_exif_cache[$photo] = $exifdata;
@@ -4277,7 +4298,8 @@ global $wpdb;
4277
  $photo = wppa( 'single_photo' );
4278
  $thumb = wppa_cache_thumb( $photo );
4279
  $album = $thumb['album'];
4280
- $photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, page_id FROM $wpdb->wppa_photos WHERE album = %s ".wppa_get_photo_order( $album ), $album ), ARRAY_A );
 
4281
  $prevpag = '0';
4282
  $nextpag = '0';
4283
  $curpag = wppa_get_the_ID();
@@ -4668,7 +4690,7 @@ global $wpdb;
4668
  $albums = wppa( 'start_album' ) ? wppa_expand_enum( wppa_alb_to_enum_children( wppa( 'start_album' ) ) ) : '';
4669
  $alb_clause = $albums ? ' AND album IN ( ' . str_replace( '.', ',' , $albums ) . ' ) ' : '';
4670
  $alb_arg = wppa( 'start_album' ) ? 'wppa-album=' . wppa_alb_to_enum_children( wppa( 'start_album' ) ) . '&' : '';
4671
- $reverse = wppa( 'reverse' ) ? ' DESC ' : '';
4672
  $from = 0;
4673
  $to = 0;
4674
 
@@ -4677,13 +4699,22 @@ global $wpdb;
4677
 
4678
  switch ( $calendar_type ) {
4679
  case 'exifdtm':
4680
- $photos = $wpdb->get_results( "SELECT id, exifdtm " .
4681
- "FROM $wpdb->wppa_photos " .
4682
- "WHERE exifdtm <> '' " .
4683
- "AND status <> 'pending' " .
4684
- "AND status <> 'scheduled' " .
4685
- $alb_clause .
4686
- "ORDER BY exifdtm" . $reverse, ARRAY_A );
 
 
 
 
 
 
 
 
 
4687
  $dates = array();
4688
  foreach ( $photos as $photo ) {
4689
  $date = substr( $photo['exifdtm'], 0, 10 );
@@ -4702,13 +4733,24 @@ global $wpdb;
4702
 
4703
  case 'timestamp':
4704
  case 'modified':
4705
- $photos = $wpdb->get_results( "SELECT id, " . $calendar_type . " " .
4706
- "FROM $wpdb->wppa_photos " .
4707
- "WHERE " . $calendar_type . " > 0 " .
4708
- "AND status <> 'pending' " .
4709
- "AND status <> 'scheduled' " .
4710
- $alb_clause .
4711
- "ORDER BY " . $calendar_type . "" . $reverse, ARRAY_A );
 
 
 
 
 
 
 
 
 
 
 
4712
  $dates = array();
4713
  foreach ( $photos as $photo ) {
4714
  $date = floor( $photo[$calendar_type] / $secinday );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various wppa boxes
6
+ * Version 7.2.07
7
  *
8
  */
9
 
317
  $form_core = '<form role="search" method="get" class="search-form" action="' . esc_url( home_url( '/' ) ) . '">
318
  <label>
319
  <span class="screen-reader-text">' . _x( 'Search for:', 'label' ) . '</span>
320
+ <input type="search" class="search-field" placeholder="' . esc_attr( wppa_opt( 'search_placeholder' ) ) . '" value="' . get_search_query() . '" name="s" />
321
  </label>
322
  <input type="submit" class="search-submit" value="'. esc_attr_x( 'Search', 'submit button' ) .'" />
323
  </form>';
340
  $form_core = str_replace( 'id="s"', 'id="wppa_s-'.$mocc.'"', $form_core );
341
  $form_core = str_replace( 'name="s"', 'name="wppa-searchstring"', $form_core );
342
 
343
+ // If no placeholder in form_core, add it
344
+ if ( strpos( $form_core, 'placeholder' ) === false ) {
345
+ if ( strpos( $form_core, 'name="wppa-searchstring"' ) !== false ) {
346
+ str_replace( 'name="wppa-searchstring"', 'name="wppa-searchstring" placeholder="' . esc_attr( wppa_opt( 'search_placeholder' ) ) . '" ' );
347
+ }
348
+ }
349
+
350
  // Fix previous input
351
  $form_core = str_replace( 'value=""', 'value="' . esc_attr( isset( $_REQUEST['wppa-searchstring'] ) ? $_REQUEST['wppa-searchstring'] : '' ) . '"', $form_core );
352
 
478
  }
479
  $ss_data['3'] = str_replace( '***', '...', $ss_data['3'] );
480
 
481
+ $query = "SELECT slug FROM $wpdb->wppa_index
482
+ WHERE albums <> ''
483
+ ORDER BY slug";
484
  $albumtxt = $wpdb->get_results( $query, ARRAY_A );
485
+ $query = "SELECT slug FROM $wpdb->wppa_index
486
+ WHERE photos <> ''
487
+ ORDER BY slug";
488
  $phototxt = $wpdb->get_results( $query, ARRAY_A );
489
 
490
  // IPTC
491
  $iptclist = wppa_switch( 'save_iptc' ) ?
492
  $wpdb->get_results( "SELECT tag, description FROM $wpdb->wppa_iptc
493
+ WHERE photo = '0'
494
+ AND status <> 'hide'", ARRAY_A ) : array();
495
 
496
  // Translate (for multilanguage qTranslate-able labels )
497
  if ( ! empty( $iptclist ) ) {
506
  // EXIF
507
  $exiflist = wppa_switch( 'save_exif' ) ?
508
  $wpdb->get_results( "SELECT tag, description, status FROM $wpdb->wppa_exif
509
+ WHERE photo = '0'
510
+ AND status <> 'hide'", ARRAY_A ) : array();
511
 
512
  // Translate (for multilanguage qTranslate-able labels), // or remove if no non-empty items
 
513
  if ( ! empty( $exiflist ) ) {
514
  foreach( array_keys( $exiflist ) as $idx ) {
515
+ $exiflist[$idx]['description'] = __( $exiflist[$idx]['description'] );
 
 
 
 
 
 
 
 
 
516
  }
517
  }
518
 
1327
 
1328
  $result .= '
1329
  <script type="text/javascript" >
1330
+ function wppaProcessMultiTagRequest'.wppa('mocc').'() {
1331
  var any = false;
1332
  var url="' . wppa_encrypt_url( $hr ) . '";';
1333
 
1357
  if ( $tags ) foreach ( $tags as $tag ) {
1358
  if ( ! $seltags || in_array( $tag['tag'], $selarr ) ) {
1359
  $result .= '
1360
+ if ( document.getElementById( "wppa-'.wppa('mocc').'-'.str_replace( ' ', '_', $tag['tag']).'" ).checked ) {' .
1361
  'url+="'.urlencode($tag['tag']).'"+sep;' .
1362
  'any = true;
1363
  }';
1452
  ' >' .
1453
  '<input' .
1454
  ' type="checkbox"' .
1455
+ ' id="wppa-'.wppa('mocc').'-'.str_replace( ' ', '_', $tag['tag'] ).'"' .
1456
  ' ' . $checked .
1457
  ' />' .
1458
  '&nbsp;' . str_replace( ' ', '&nbsp;', __( $tag['tag'] ) ) .
1475
  $result .= '</table>';
1476
  $result .= '<input' .
1477
  ' type="button"' .
1478
+ ' onclick="wppaProcessMultiTagRequest'.wppa('mocc').'()"' .
1479
  ' value="' . __( 'Find!', 'wp-photo-album-plus' ) . '"' .
1480
  ' />';
1481
  }
1838
  $share_url = wppa_convert_to_pretty( get_permalink( $p ) );
1839
 
1840
  // The share title
1841
+ $share_name = $wpdb->get_var( $wpdb->prepare( "SELECT post_title FROM $wpdb->posts
1842
+ WHERE ID = %d", $p ) );
1843
 
1844
  // The share description
1845
+ $share_desc = $wpdb->get_var( $wpdb->prepare( "SELECT post_content FROM $wpdb->posts
1846
+ WHERE ID = %d", $p ) );
1847
  $share_desc = strip_tags( strip_shortcodes( $share_desc ) );
1848
  if ( strlen( $share_desc ) > 150 ) {
1849
  $share_desc = substr( $share_desc, 0, 120 ) . '...';
2463
 
2464
  // Login not required, but there are no public albums while user not logged in?
2465
  elseif ( ! is_user_logged_in() ) {
2466
+ $public_exist = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums
2467
+ WHERE owner = '--- public ---' " );
 
2468
 
2469
  if ( ! $public_exist ) {
2470
  return '';
3550
 
3551
  // Loop the comments already there
3552
  $n_comments = 0;
3553
+ if ( wppa_switch( 'comments_desc' ) ) {
3554
+ $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments
3555
+ WHERE photo = %d
3556
+ ORDER BY id DESC", $id ), ARRAY_A );
3557
+ }
3558
+ else {
3559
+ $comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_comments
3560
+ WHERE photo = %d
3561
+ ORDER BY id", $id ), ARRAY_A );
3562
+ }
3563
  $com_count = count( $comments );
3564
  $color = 'darkgrey';
3565
  if ( wppa_opt( 'fontcolor_box' ) ) $color = wppa_opt( 'fontcolor_box' );
3634
 
3635
  // Still no user, try to find him by display name
3636
  if ( ! $usr ) {
3637
+ $usr = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->users
3638
+ WHERE display_name = %s", $comment['user'] ) );
3639
 
3640
  // Accept this user if he is the only one with this display name
3641
  if ( count( $usr ) != 1 ) {
3975
 
3976
  // Get tha labels if not yet present
3977
  if ( ! is_array( $wppa_iptc_labels ) ) {
3978
+ $wppa_iptc_labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_iptc
3979
+ WHERE photo = '0'
3980
+ ORDER BY tag", ARRAY_A );
3981
  }
3982
 
3983
  $count = 0;
3992
 
3993
  // Get the photo data
3994
  if ( $iptcdata === false ) {
3995
+ $iptcdata = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_iptc
3996
+ WHERE photo = %s
3997
+ ORDER BY tag", $photo ), ARRAY_A );
3998
 
3999
  // Save in cache, even when empty
4000
  $wppa_iptc_cache[$photo] = $iptcdata;
4092
 
4093
  // Get tha labels if not yet present
4094
  if ( ! is_array( $wppa_exif_labels ) ) {
4095
+ $wppa_exif_labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_exif
4096
+ WHERE photo = '0'
4097
+ ORDER BY tag", ARRAY_A );
4098
  }
4099
 
4100
  $count = 0;
4111
 
4112
  // Get the photo data
4113
  if ( $exifdata === false ) {
4114
+ $exifdata = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif
4115
+ WHERE photo = %s
4116
+ ORDER BY tag", $photo ), ARRAY_A );
4117
 
4118
  // Save in cache, even when empty
4119
  $wppa_exif_cache[$photo] = $exifdata;
4298
  $photo = wppa( 'single_photo' );
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();
4690
  $albums = wppa( 'start_album' ) ? wppa_expand_enum( wppa_alb_to_enum_children( wppa( 'start_album' ) ) ) : '';
4691
  $alb_clause = $albums ? ' AND album IN ( ' . str_replace( '.', ',' , $albums ) . ' ) ' : '';
4692
  $alb_arg = wppa( 'start_album' ) ? 'wppa-album=' . wppa_alb_to_enum_children( wppa( 'start_album' ) ) . '&' : '';
4693
+ // $reverse = wppa( 'reverse' ) ? ' DESC ' : '';
4694
  $from = 0;
4695
  $to = 0;
4696
 
4699
 
4700
  switch ( $calendar_type ) {
4701
  case 'exifdtm':
4702
+ if ( wppa( 'reverse' ) ) {
4703
+ $photos = $wpdb->get_results( "SELECT id, exifdtm FROM $wpdb->wppa_photos
4704
+ WHERE exifdtm <> ''
4705
+ AND status <> 'pending'
4706
+ AND status <> 'scheduled' " .
4707
+ $alb_clause . "
4708
+ ORDER BY exifdtm DESC", ARRAY_A );
4709
+ }
4710
+ else {
4711
+ $photos = $wpdb->get_results( "SELECT id, exifdtm FROM $wpdb->wppa_photos
4712
+ WHERE exifdtm <> ''
4713
+ AND status <> 'pending'
4714
+ AND status <> 'scheduled' " .
4715
+ $alb_clause . "
4716
+ ORDER BY exifdtm", ARRAY_A );
4717
+ }
4718
  $dates = array();
4719
  foreach ( $photos as $photo ) {
4720
  $date = substr( $photo['exifdtm'], 0, 10 );
4733
 
4734
  case 'timestamp':
4735
  case 'modified':
4736
+ if ( wppa( 'reverse' ) ) {
4737
+ $photos = $wpdb->get_results( "SELECT id, " . $calendar_type . "
4738
+ FROM $wpdb->wppa_photos
4739
+ WHERE " . $calendar_type . " > 0
4740
+ AND status <> 'pending'
4741
+ AND status <> 'scheduled' " .
4742
+ $alb_clause . "
4743
+ ORDER BY " . $calendar_type . " DESC", ARRAY_A );
4744
+ }
4745
+ else {
4746
+ $photos = $wpdb->get_results( "SELECT id, " . $calendar_type . "
4747
+ FROM $wpdb->wppa_photos
4748
+ WHERE " . $calendar_type . " > 0
4749
+ AND status <> 'pending'
4750
+ AND status <> 'scheduled' " .
4751
+ $alb_clause . "
4752
+ ORDER BY " . $calendar_type, ARRAY_A );
4753
+ }
4754
  $dates = array();
4755
  foreach ( $photos as $photo ) {
4756
  $date = floor( $photo[$calendar_type] / $secinday );
wppa-filter.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
- * Version 7.2.06
7
  *
8
  */
9
 
@@ -100,7 +100,7 @@ static $seqno;
100
  add_shortcode( 'wppa_div', 'wppa_shortcode_div' );
101
 
102
  // The shortcode handler
103
- function wppa_shortcodes( $xatts, $content = '' ) {
104
  global $wppa;
105
  global $wppa_postid;
106
  global $wppa_api_version;
@@ -131,9 +131,8 @@ 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
- $content = htmlentities( $content );
137
 
138
  // Init
139
  wppa_reset_occurrance();
@@ -145,9 +144,6 @@ global $wppa_revno;
145
  $wppa_postid = wppa_get_the_ID(); // Remember the post id
146
  }
147
 
148
- // Whatever is entered between [wppa ...] and [/wppa]
149
- $wppa['shortcode_content'] = ''; // $content; // This is obsolete, we do no longer use this
150
-
151
  // Check for inconsistency
152
  if ( $atts['alt'] && wppa_switch( 'render_shortcode_always' ) ) {
153
  wppa_dbg_msg( 'ERROR! Either untick Table IV-A8: Render shortcode always, or remove the alt="'.$atts['alt'].'" attribute from the shortcode on this page/post', 'red', 'force' );
@@ -637,24 +633,30 @@ static $seed;
637
 
638
  if ( wppa_opt( 'photo_shortcode_random_albums' ) != '-2' ) {
639
  $albs = str_replace( '.', ',', wppa_expand_enum( wppa_opt( 'photo_shortcode_random_albums' ) ) );
640
- $photo = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos " .
641
- "WHERE album IN (" . $albs . ") " .
642
- "ORDER BY RAND(%d) LIMIT 1", $seed ) );
 
643
  }
644
  else {
645
- $photo = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos " .
646
- "ORDER BY RAND(%d) LIMIT 1", $seed ) );
 
647
  }
648
  if ( $photo ) {
649
  if ( wppa_switch( 'photo_shortcode_random_fixed' ) ) {
650
- $post_content = $wpdb->get_var( $wpdb->prepare( "SELECT post_content FROM " . $wpdb->posts . " WHERE ID = %d", $wppa_postid ) );
 
 
651
  if ( wppa_switch( 'photo_shortcode_random_fixed_html' ) ) {
652
  $post_content = preg_replace( '/\[photo random\]/', do_shortcode('[photo '.$photo.']'), $post_content, 1, $done );
653
  }
654
  else {
655
  $post_content = preg_replace( '/\[photo random\]/', '[photo '.$photo.']', $post_content, 1, $done );
656
  }
657
- $wpdb->query( $wpdb->prepare( "UPDATE " . $wpdb->posts . " SET post_content = %s WHERE ID = %d", $post_content, $wppa_postid ) );
 
 
658
  }
659
  }
660
  else {
@@ -687,7 +689,7 @@ static $seed;
687
  $wppa['is_single'] = '1';
688
  break;
689
  default:
690
- wppa_log( 'err', 'Unimplemented photo_shortcode_type: ' . $type . ' in wppa_photo_shortcodes()' );
691
  break;
692
  }
693
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * get the albums via shortcode handler
6
+ * Version 7.2.07
7
  *
8
  */
9
 
100
  add_shortcode( 'wppa_div', 'wppa_shortcode_div' );
101
 
102
  // The shortcode handler
103
+ function wppa_shortcodes( $xatts ) {
104
  global $wppa;
105
  global $wppa_postid;
106
  global $wppa_api_version;
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] = htmlentities( strip_tags( $atts[$key] ) );
135
  }
 
136
 
137
  // Init
138
  wppa_reset_occurrance();
144
  $wppa_postid = wppa_get_the_ID(); // Remember the post id
145
  }
146
 
 
 
 
147
  // Check for inconsistency
148
  if ( $atts['alt'] && wppa_switch( 'render_shortcode_always' ) ) {
149
  wppa_dbg_msg( 'ERROR! Either untick Table IV-A8: Render shortcode always, or remove the alt="'.$atts['alt'].'" attribute from the shortcode on this page/post', 'red', 'force' );
633
 
634
  if ( wppa_opt( 'photo_shortcode_random_albums' ) != '-2' ) {
635
  $albs = str_replace( '.', ',', wppa_expand_enum( wppa_opt( 'photo_shortcode_random_albums' ) ) );
636
+ $photo = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos
637
+ WHERE album IN (" . $albs . ")
638
+ ORDER BY RAND(%d)
639
+ LIMIT 1", $seed ) );
640
  }
641
  else {
642
+ $photo = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM $wpdb->wppa_photos
643
+ ORDER BY RAND(%d)
644
+ LIMIT 1", $seed ) );
645
  }
646
  if ( $photo ) {
647
  if ( wppa_switch( 'photo_shortcode_random_fixed' ) ) {
648
+ $post_content = $wpdb->get_var( $wpdb->prepare( "SELECT post_content
649
+ FROM $wpdb->posts
650
+ WHERE ID = %d", $wppa_postid ) );
651
  if ( wppa_switch( 'photo_shortcode_random_fixed_html' ) ) {
652
  $post_content = preg_replace( '/\[photo random\]/', do_shortcode('[photo '.$photo.']'), $post_content, 1, $done );
653
  }
654
  else {
655
  $post_content = preg_replace( '/\[photo random\]/', '[photo '.$photo.']', $post_content, 1, $done );
656
  }
657
+ $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->posts
658
+ SET post_content = %s
659
+ WHERE ID = %d", $post_content, $wppa_postid ) );
660
  }
661
  }
662
  else {
689
  $wppa['is_single'] = '1';
690
  break;
691
  default:
692
+ wppa_log( 'err', "Unimplemented photo_shortcode_type: $type in wppa_photo_shortcodes()" );
693
  break;
694
  }
695
 
wppa-functions.php CHANGED
@@ -151,14 +151,14 @@ global $wppa_session;
151
  if ( wppa_get_get( 'superview' ) ) {
152
  $wppa_session['superview'] = wppa( 'is_slide' ) ? 'slide': 'thumbs';
153
  $wppa_session['superalbum'] = wppa( 'start_album' );
154
- // wppa_save_session();
155
  wppa( 'photos_only', true );
156
  }
157
  wppa( 'is_upldr', wppa_get_get( 'upldr' ) );
158
  if ( wppa( 'is_upldr' ) ) wppa( 'photos_only', true );
159
  wppa( 'is_owner', wppa_get_get( 'owner' ) );
160
  if ( wppa( 'is_owner' ) ) {
161
- $albs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE owner = %s ", wppa( 'is_owner' ) ), ARRAY_A );
 
162
  wppa_cache_album( 'add', $albs );
163
  $id = '';
164
  if ( $albs ) foreach ( $albs as $alb ) {
@@ -235,7 +235,9 @@ 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 WHERE page_id = %d LIMIT 1", wppa_get_the_id() ) );
 
 
239
  wppa( 'single_photo', $photo );
240
  if ( ! wppa( 'single_photo' ) ) {
241
  wppa_dbg_msg( 'No photo found for page '.wppa_get_the_id(), 'red', 'force' );
@@ -289,18 +291,26 @@ global $wppa_session;
289
  if ( $limit ) {
290
  if ( $parent ) {
291
  if ( $limit ) {
292
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %s ORDER BY timestamp DESC LIMIT %d", $parent, $limit );
 
 
 
293
  }
294
  else {
295
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %s ORDER BY timestamp DESC", $parent );
 
 
296
  }
297
  }
298
  else {
299
  if ( $limit ) {
300
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums ORDER BY timestamp DESC LIMIT %d", $limit );
 
 
301
  }
302
  else {
303
- $q = "SELECT * FROM $wpdb->wppa_albums ORDER BY timestamp DESC";
 
304
  }
305
  }
306
  $albs = $wpdb->get_results( $q, ARRAY_A );
@@ -888,7 +898,7 @@ function wppa_get_related_data() {
888
  global $wpdb;
889
 
890
  $pagid = wppa_get_the_id();
891
- $data = $wpdb->get_var( "SELECT post_content FROM " . $wpdb->posts . " WHERE ID = " . $pagid );
892
  $data = str_replace( array( ' ', ',', '.', "\t", "\r", "0", "x0B", "\n" ), ';', $data );
893
  $data = strip_tags( $data );
894
  $data = strip_shortcodes( $data );
@@ -1079,29 +1089,38 @@ global $wppa_session;
1079
  }
1080
  elseif ( wppa( 'last_albums' ) ) { // is_cover = true. For the order sequence, see remark in wppa_albums()
1081
  if ( wppa( 'last_albums_parent' ) ) {
1082
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %s ORDER BY timestamp DESC LIMIT %d", wppa( 'last_albums_parent' ), wppa( 'last_albums' ) );
 
 
 
1083
  }
1084
  else {
1085
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums ORDER BY timestamp DESC LIMIT %d", wppa( 'last_albums' ) );
 
 
1086
  }
1087
  $albums = $wpdb->get_results( $q, ARRAY_A );
1088
  }
1089
  elseif ( wppa_is_int( $id ) ) {
1090
  if ( wppa( 'is_cover' ) ) {
1091
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE id = %d", $id );
 
1092
  }
1093
  else {
1094
- $q = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = %d " . wppa_get_album_order( $id ), $id );
 
1095
  }
1096
  $albums = $wpdb->get_results( $q, ARRAY_A );
1097
  }
1098
  elseif ( strpos( $id, '.' ) !== false ) { // Album enum
1099
  $ids = wppa_series_to_array( $id );
1100
  if ( wppa( 'is_cover' ) ) {
1101
- $q = "SELECT * FROM $wpdb->wppa_albums WHERE id = ".implode( " OR id = ", $ids )." ".wppa_get_album_order();
 
1102
  }
1103
  else {
1104
- $q = "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = ".implode( " OR a_parent = ", $ids )." ".wppa_get_album_order();
 
1105
  }
1106
  wppa_dbg_msg( $q, 'red' );
1107
  $albums = $wpdb->get_results( $q, ARRAY_A );
@@ -1200,8 +1219,8 @@ global $wppa_session;
1200
 
1201
  // Single image slideshow?
1202
  if ( wppa( 'start_photo' ) && wppa( 'is_single' ) ) {
1203
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1204
- "WHERE id = %s", wppa( 'start_photo' ) );
1205
  }
1206
 
1207
  // Uploader? // lasten with owner rstriction is handled at the Lasten case
@@ -1209,9 +1228,9 @@ global $wppa_session;
1209
  $status = "status <> 'pending' AND status <> 'scheduled'";
1210
  if ( ! is_user_logged_in() ) $status .= " AND status <> 'private'";
1211
 
1212
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1213
- "WHERE " . $album_clause . " AND owner = %s AND ( " . $status . " ) " .
1214
- "ORDER BY timestamp DESC", wppa( 'is_upldr' ) );
1215
  }
1216
 
1217
  // Topten?
@@ -1255,10 +1274,11 @@ global $wppa_session;
1255
  $non_zero = "AND rating_count > 0 ";
1256
  }
1257
  }
1258
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1259
- "WHERE $album_clause AND ( $status ) " .
1260
- $non_zero .
1261
- "ORDER BY $sortby LIMIT $max";
 
1262
 
1263
  $count_first = false;
1264
  }
@@ -1267,9 +1287,11 @@ global $wppa_session;
1267
  elseif ( wppa( 'is_featen' ) ) {
1268
  $max = wppa( 'featen_count' );
1269
 
1270
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1271
- "WHERE $album_clause AND status = 'featured' " .
1272
- "ORDER BY RAND( " . wppa_get_randseed() . " ) DESC LIMIT $max";
 
 
1273
 
1274
  $count_first = false;
1275
  }
@@ -1288,18 +1310,22 @@ global $wppa_session;
1288
 
1289
  if ( current_user_can( 'wppa_moderate' ) ) {
1290
 
1291
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1292
- "WHERE ( $album_clause ) " .
1293
- "AND ( $newtime ) " .
1294
- $owner_restriction .
1295
- "ORDER BY $order_by DESC LIMIT $max";
 
1296
  }
1297
  else {
1298
 
1299
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1300
- "WHERE ( $album_clause ) AND ( $status ) AND ( $newtime ) " .
1301
- $owner_restriction .
1302
- "ORDER BY $order_by DESC LIMIT $max";
 
 
 
1303
  }
1304
  }
1305
 
@@ -1307,15 +1333,18 @@ global $wppa_session;
1307
  else {
1308
  if ( current_user_can( 'wppa_moderate' ) ) {
1309
 
1310
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1311
- "WHERE $album_clause " .
1312
- "ORDER BY $order_by DESC LIMIT $max";
 
1313
  }
1314
  else {
1315
 
1316
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1317
- "WHERE ( $album_clause ) AND ( $status ) " .
1318
- "ORDER BY $order_by DESC LIMIT $max";
 
 
1319
  }
1320
  }
1321
 
@@ -1343,7 +1372,10 @@ global $wppa_session;
1343
  // To keep the sequence ok ( in sequence of comments desc ), do the queries one by one
1344
  $thumbs = array();
1345
  if ( is_array( $photo_ids ) ) foreach( $photo_ids as $id ) {
1346
- $temp = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE ".$status." AND album > '0' AND id = %s", $id ), ARRAY_A );
 
 
 
1347
  if ( $temp ) {
1348
  $thumbs[] = $temp;
1349
  }
@@ -1392,17 +1424,17 @@ global $wppa_session;
1392
 
1393
  // Prepare the query
1394
  if ( current_user_can( 'wppa_moderate' ) ) {
1395
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1396
- "WHERE ( $tags_like ) " .
1397
- "AND $album_clause " .
1398
- wppa_get_photo_order( '0' );
1399
  }
1400
  else {
1401
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1402
- "WHERE ( $tags_like ) " .
1403
- "AND $album_clause " .
1404
- "AND $status " .
1405
- wppa_get_photo_order( '0' );
1406
  }
1407
  }
1408
 
@@ -1432,34 +1464,34 @@ global $wppa_session;
1432
  $is = 'LIKE';
1433
  }
1434
  if ( current_user_can( 'wppa_moderate' ) ) {
1435
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1436
- "WHERE name " . $is . " %s " .
1437
- "AND album > '0' " .
1438
- wppa_get_photo_order( '0' ), $data );
1439
  }
1440
  else {
1441
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1442
- "WHERE name " . $is . " %s " .
1443
- "AND album > '0' " .
1444
- "AND " . $status . " " .
1445
- wppa_get_photo_order( '0' ), $data );
1446
  }
1447
  break;
1448
 
1449
  // Owner
1450
  case 'o':
1451
  if ( current_user_can( 'wppa_moderate' ) ) {
1452
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1453
- "WHERE owner = %s " .
1454
- "AND album > '0' " .
1455
- wppa_get_photo_order( '0' ), $data );
1456
  }
1457
  else {
1458
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1459
- "WHERE owner = %s " .
1460
- "AND album > '0' " .
1461
- "AND " . $status . " " .
1462
- wppa_get_photo_order( '0' ), $data );
1463
  }
1464
  break;
1465
 
@@ -1479,10 +1511,10 @@ global $wppa_session;
1479
  $tagids = $taglist[$data]['ids'];
1480
  }
1481
  if ( count( $tagids ) > '0' ) {
1482
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1483
- "WHERE ".$status." " .
1484
- "AND id IN (" . implode( ',',$tagids ) . ") " .
1485
- "AND album > '0' ";
1486
  }
1487
  break;
1488
 
@@ -1500,7 +1532,8 @@ global $wppa_session;
1500
  $is = 'LIKE';
1501
  }
1502
  }
1503
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index WHERE slug ".$is." %s", $temp['0'] );
 
1504
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1505
  $ids = array();
1506
  foreach( $indexes as $item ) {
@@ -1516,7 +1549,8 @@ global $wppa_session;
1516
  }
1517
  }
1518
 
1519
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index WHERE slug ".$is." %s", $temp[$i] );
 
1520
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1521
  $deltaids = array();
1522
  foreach( $indexes as $item ) {
@@ -1535,7 +1569,8 @@ global $wppa_session;
1535
  $is = 'LIKE';
1536
  }
1537
  }
1538
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_index WHERE slug ".$is." %s", $data );
 
1539
  $indexes = $wpdb->get_results( $query, ARRAY_A );
1540
  $ids = array();
1541
  foreach( $indexes as $item ) {
@@ -1545,27 +1580,28 @@ global $wppa_session;
1545
  if ( empty( $ids ) ) {
1546
  $ids = array( '0' ); // Dummy
1547
  }
1548
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1549
- "WHERE ".$status." " .
1550
- "AND album > '0' " .
1551
- "AND id IN (" . trim( implode( ',', $ids ), ',' ) . ")";
1552
  break;
1553
 
1554
  // Iptc
1555
  case 'i':
1556
  $itag = str_replace( 'H', '#', $ss_data['2'] );
1557
  $desc = $ss_data['3'];
1558
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_iptc " .
1559
- "WHERE tag = %s AND description = %s", $itag, $desc );
 
1560
  $iptclines = $wpdb->get_results( $query, ARRAY_A );
1561
  $ids = '0';
1562
  if ( is_array( $iptclines ) ) foreach( $iptclines as $item ) {
1563
  $ids .= ','.$item['photo'];
1564
  }
1565
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1566
- "WHERE ".$status." " .
1567
- "AND album > '0' " .
1568
- "AND id IN (" . $ids . ")";
1569
  break;
1570
 
1571
  // Exif
@@ -1573,23 +1609,19 @@ global $wppa_session;
1573
  $etag = substr( str_replace( 'H', '#', $ss_data['2'] ), 0, 6 );
1574
  $brand = substr( $ss_data[2], 6 );
1575
  $desc = $ss_data['3'];
1576
- // if ( $brand ) {
1577
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif " .
1578
- "WHERE tag = %s AND f_description = %s AND brand = %s", $etag, $desc, $brand );
1579
- // }
1580
- // else {
1581
- // $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif " .
1582
- // "WHERE tag = %s AND f_description = %s", $etag, $desc );
1583
- // }
1584
  $exiflines = $wpdb->get_results( $query, ARRAY_A );
1585
  $ids = '0';
1586
  if ( is_array( $exiflines ) ) foreach( $exiflines as $item ) {
1587
- $ids .= ','.$item['photo'];
1588
  }
1589
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1590
- "WHERE ".$status." " .
1591
- "AND album > '0' " .
1592
- "AND id IN (" . $ids . ")";
1593
  break;
1594
 
1595
  default:
@@ -1611,7 +1643,10 @@ global $wppa_session;
1611
 
1612
  // Remove scheduled and pending and trashed when not can moderate
1613
  if ( ! current_user_can( 'wppa_moderate' ) ) {
1614
- $needmod = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE status = 'scheduled' OR status = 'pending' OR album <= '-9'" );
 
 
 
1615
  if ( is_array( $needmod ) ) {
1616
  $final_array = array_diff( $final_array, $needmod );
1617
  }
@@ -1619,7 +1654,8 @@ global $wppa_session;
1619
 
1620
  // Remove private and trashed when not logged in
1621
  if ( ! is_user_logged_in() ) {
1622
- $needlogin = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_photos WHERE status = 'private' OR album <= '-9'" );
 
1623
  if ( is_array( $needlogin ) ) {
1624
  $final_array = array_diff( $final_array, $needlogin );
1625
  }
@@ -1649,7 +1685,8 @@ global $wppa_session;
1649
  // Maybe cats limitation
1650
  elseif ( wppa( 'catbox' ) ) {
1651
 
1652
- $catalbs = $wpdb->get_col( "SELECT id FROM $wpdb->wppa_albums WHERE cats LIKE '%" . wppa( 'catbox' ) . "%' " );
 
1653
 
1654
  if ( ! empty( $catalbs ) ) {
1655
  $alb_clause = " AND album IN ( " . implode( ',', $catalbs ) . " ) ";
@@ -1662,7 +1699,8 @@ global $wppa_session;
1662
  // exclude separate if required
1663
  elseif ( ! $alb_clause && wppa_switch( 'excl_sep' ) ) {
1664
  $sep_albs = '';
1665
- $temp = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_albums WHERE a_parent = '-1'", ARRAY_A );
 
1666
  if ( ! empty( $temp ) ) {
1667
  $t = array();
1668
  foreach ( $temp as $item ) {
@@ -1694,7 +1732,11 @@ global $wppa_session;
1694
  }
1695
 
1696
  // Construct the query
1697
- $query = "SELECT * FROM $wpdb->wppa_photos WHERE " . $selection . $alb_clause . wppa_get_photo_order( '0' ) . $limit;
 
 
 
 
1698
  }
1699
 
1700
  // Calendar?
@@ -1708,25 +1750,36 @@ global $wppa_session;
1708
  }
1709
  switch ( wppa( 'calendar' ) ) {
1710
  case 'exifdtm':
1711
- $selection = "exifdtm LIKE '" . strip_tags( wppa( 'caldate' ) ) . "%' AND status <> 'pending' AND status <> 'scheduled' ";
1712
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1713
- "WHERE " . $selection . $alb_clause . $order;
 
 
 
1714
  break;
1715
 
1716
  case 'timestamp':
1717
  $t1 = strval( intval( wppa( 'caldate' ) * 24*60*60 ) );
1718
  $t2 = $t1 + 24*60*60;
1719
- $selection = "timestamp >= $t1 AND timestamp < $t2 AND status <> 'pending' AND status <> 'scheduled' ";
1720
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1721
- "WHERE " . $selection . $alb_clause . $order;
 
 
 
 
1722
  break;
1723
 
1724
  case 'modified':
1725
  $t1 = strval( intval( wppa( 'caldate' ) * 24*60*60 ) );
1726
  $t2 = $t1 + 24*60*60;
1727
- $selection = "modified >= $t1 AND modified < $t2 AND status <> 'pending' AND status <> 'scheduled' ";
1728
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1729
- "WHERE " . $selection . $alb_clause . $order;
 
 
 
 
1730
  break;
1731
 
1732
  default:
@@ -1760,29 +1813,32 @@ global $wppa_session;
1760
  $query = "SELECT * FROM $wpdb->wppa_photos " . wppa_get_photo_order( '0' ) . $lim;
1761
  }
1762
  else {
1763
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1764
- "WHERE ( ( " . $status . " ) OR owner = %s ) " .
1765
- "AND album > '0' " .
1766
- wppa_get_photo_order( '0' ) .
1767
- $lim,
1768
- wppa_get_user() );
 
1769
  }
1770
  }
1771
 
1772
  // Single album ?
1773
  elseif ( wppa_is_int( wppa( 'start_album' ) ) ) {
1774
  if ( current_user_can( 'wppa_moderate' ) ) {
1775
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1776
- "WHERE album = " . wppa( 'start_album' ) . " " .
1777
- wppa_get_photo_order( wppa( 'start_album' ) ) .
1778
- $lim;
1779
  }
1780
  else {
1781
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1782
- "WHERE ( ( " . $status . " ) OR owner = %s ) AND album = " . wppa( 'start_album' ) . " " .
1783
- wppa_get_photo_order( wppa( 'start_album' ) ) .
1784
- $lim,
1785
- wppa_get_user() );
 
 
1786
  }
1787
  }
1788
 
@@ -1790,17 +1846,19 @@ global $wppa_session;
1790
  elseif ( is_array( $allalb ) ) {
1791
  $wherealbum = ' album IN (' . implode( ',', $allalb ) . ') ';
1792
  if ( current_user_can( 'wppa_moderate' ) ) {
1793
- $query = "SELECT * FROM $wpdb->wppa_photos " .
1794
- "WHERE " . $wherealbum . " " .
1795
- wppa_get_photo_order( '0' ) .
1796
- $lim;
1797
  }
1798
  else {
1799
- $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos " .
1800
- "WHERE ( ( " . $status . " ) OR owner = %s ) AND " . $wherealbum . " " .
1801
- wppa_get_photo_order( '0' ) .
1802
- $lim,
1803
- wppa_get_user() );
 
 
1804
  }
1805
  }
1806
  }
@@ -1866,7 +1924,7 @@ global $wpdb;
1866
  // Trim searchword to a max of 20 chars
1867
  if ( strlen( $word ) > 20 ) $word = substr( $word, 0, 20 );
1868
 
1869
- // Floating searchtoken?
1870
  if ( wppa_switch( 'wild_front' ) ) {
1871
  $idxs = $wpdb->get_col( "SELECT " . $type . " FROM $wpdb->wppa_index WHERE slug LIKE '%" . $word . "%'" );
1872
  }
151
  if ( wppa_get_get( 'superview' ) ) {
152
  $wppa_session['superview'] = wppa( 'is_slide' ) ? 'slide': 'thumbs';
153
  $wppa_session['superalbum'] = wppa( 'start_album' );
 
154
  wppa( 'photos_only', true );
155
  }
156
  wppa( 'is_upldr', wppa_get_get( 'upldr' ) );
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 = '';
164
  if ( $albs ) foreach ( $albs as $alb ) {
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' ) ) {
243
  wppa_dbg_msg( 'No photo found for page '.wppa_get_the_id(), 'red', 'force' );
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
  }
316
  $albs = $wpdb->get_results( $q, ARRAY_A );
898
  global $wpdb;
899
 
900
  $pagid = wppa_get_the_id();
901
+ $data = $wpdb->get_var( $wpdb->prepare( "SELECT post_content FROM $wpdb->posts WHERE ID = %d", $pagid ) );
902
  $data = str_replace( array( ' ', ',', '.', "\t", "\r", "0", "x0B", "\n" ), ';', $data );
903
  $data = strip_tags( $data );
904
  $data = strip_shortcodes( $data );
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 );
1114
  }
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' );
1126
  $albums = $wpdb->get_results( $q, ARRAY_A );
1219
 
1220
  // Single image slideshow?
1221
  if ( wppa( 'start_photo' ) && wppa( 'is_single' ) ) {
1222
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1223
+ WHERE id = %s", wppa( 'start_photo' ) );
1224
  }
1225
 
1226
  // Uploader? // lasten with owner rstriction is handled at the Lasten case
1228
  $status = "status <> 'pending' AND status <> 'scheduled'";
1229
  if ( ! is_user_logged_in() ) $status .= " AND status <> 'private'";
1230
 
1231
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1232
+ WHERE " . $album_clause . " AND owner = %s AND ( " . $status . " )
1233
+ ORDER BY timestamp DESC", wppa( 'is_upldr' ) );
1234
  }
1235
 
1236
  // Topten?
1274
  $non_zero = "AND rating_count > 0 ";
1275
  }
1276
  }
1277
+ $query = "SELECT * FROM $wpdb->wppa_photos
1278
+ WHERE $album_clause AND ( $status )
1279
+ $non_zero
1280
+ ORDER BY $sortby
1281
+ LIMIT $max";
1282
 
1283
  $count_first = false;
1284
  }
1287
  elseif ( wppa( 'is_featen' ) ) {
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";
1295
 
1296
  $count_first = false;
1297
  }
1310
 
1311
  if ( current_user_can( 'wppa_moderate' ) ) {
1312
 
1313
+ $query = "SELECT * FROM $wpdb->wppa_photos
1314
+ WHERE ( $album_clause )
1315
+ AND ( $newtime )
1316
+ $owner_restriction
1317
+ ORDER BY $order_by DESC
1318
+ LIMIT $max";
1319
  }
1320
  else {
1321
 
1322
+ $query = "SELECT * FROM $wpdb->wppa_photos
1323
+ WHERE ( $album_clause )
1324
+ AND ( $status )
1325
+ AND ( $newtime )
1326
+ $owner_restriction
1327
+ ORDER BY $order_by DESC
1328
+ LIMIT $max";
1329
  }
1330
  }
1331
 
1333
  else {
1334
  if ( current_user_can( 'wppa_moderate' ) ) {
1335
 
1336
+ $query = "SELECT * FROM $wpdb->wppa_photos
1337
+ WHERE $album_clause
1338
+ ORDER BY $order_by DESC
1339
+ LIMIT $max";
1340
  }
1341
  else {
1342
 
1343
+ $query = "SELECT * FROM $wpdb->wppa_photos
1344
+ WHERE ( $album_clause )
1345
+ AND ( $status )
1346
+ ORDER BY $order_by DESC
1347
+ LIMIT $max";
1348
  }
1349
  }
1350
 
1372
  // To keep the sequence ok ( in sequence of comments desc ), do the queries one by one
1373
  $thumbs = array();
1374
  if ( is_array( $photo_ids ) ) foreach( $photo_ids as $id ) {
1375
+ $temp = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
1376
+ WHERE $status
1377
+ AND album > '0'
1378
+ AND id = %s", $id ), ARRAY_A );
1379
  if ( $temp ) {
1380
  $thumbs[] = $temp;
1381
  }
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
 
1464
  $is = 'LIKE';
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
1482
  case 'o':
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
 
1511
  $tagids = $taglist[$data]['ids'];
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
 
1532
  $is = 'LIKE';
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 ) {
1549
  }
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 ) {
1569
  $is = 'LIKE';
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 ) {
1580
  if ( empty( $ids ) ) {
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
1590
  case 'i':
1591
  $itag = str_replace( 'H', '#', $ss_data['2'] );
1592
  $desc = $ss_data['3'];
1593
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_iptc
1594
+ WHERE tag = %s
1595
+ AND description = %s", $itag, $desc );
1596
  $iptclines = $wpdb->get_results( $query, ARRAY_A );
1597
  $ids = '0';
1598
  if ( is_array( $iptclines ) ) foreach( $iptclines as $item ) {
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
1609
  $etag = substr( str_replace( 'H', '#', $ss_data['2'] ), 0, 6 );
1610
  $brand = substr( $ss_data[2], 6 );
1611
  $desc = $ss_data['3'];
1612
+ $query = $wpdb->prepare( "SELECT * FROM $wpdb->wppa_exif
1613
+ WHERE tag = %s
1614
+ AND f_description = %s
1615
+ AND brand = %s", $etag, $desc, $brand );
 
 
 
 
1616
  $exiflines = $wpdb->get_results( $query, ARRAY_A );
1617
  $ids = '0';
1618
  if ( is_array( $exiflines ) ) foreach( $exiflines as $item ) {
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
 
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 );
1652
  }
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 );
1661
  }
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 ) ) {
1692
  $alb_clause = " AND album IN ( " . implode( ',', $catalbs ) . " ) ";
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();
1706
  foreach ( $temp as $item ) {
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
 
1742
  // Calendar?
1750
  }
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
 
1761
  case 'timestamp':
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
 
1785
  default:
1813
  $query = "SELECT * FROM $wpdb->wppa_photos " . wppa_get_photo_order( '0' ) . $lim;
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' ) .
1821
+ $lim,
1822
+ wppa_get_user() );
1823
  }
1824
  }
1825
 
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,
1841
+ wppa_get_user(), wppa( 'start_album' ) );
1842
  }
1843
  }
1844
 
1846
  elseif ( is_array( $allalb ) ) {
1847
  $wherealbum = ' album IN (' . implode( ',', $allalb ) . ') ';
1848
  if ( current_user_can( 'wppa_moderate' ) ) {
1849
+ $query = "SELECT * FROM $wpdb->wppa_photos
1850
+ WHERE " . $wherealbum . " " .
1851
+ wppa_get_photo_order( '0' ) .
1852
+ $lim;
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,
1861
+ wppa_get_user() );
1862
  }
1863
  }
1864
  }
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
  }
wppa-settings-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
- * Version 7.2.06
7
  *
8
  */
9
 
@@ -362,6 +362,7 @@ global $wppa_supported_camara_brands;
362
  'wp-deferred-javascripts/wp-deferred-javascripts.php',
363
  'frndzk-photo-lightbox-gallery/frndzk_photo_gallery.php',
364
  'simple-lightbox/main.php',
 
365
  );
366
  $plugins = get_option('active_plugins');
367
  $matches = array_intersect($blacklist_plugins, $plugins);
@@ -408,7 +409,7 @@ global $wppa_supported_camara_brands;
408
 
409
  // Check for 'many' albums
410
  if ( wppa_opt( 'photo_admin_max_albums' ) ) { // Not OFF
411
- $abs = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums " );
412
  if ( wppa_opt( 'photo_admin_max_albums' ) < $abs ) {
413
  wppa_warning_message( __( 'This system contains more albums than the maximum set in Table IX-B6.3.', 'wp-photo-album-plus' ) . ' ' .
414
  __( 'No problem, but some widgets may not work and some album selectionboxes will revert to a simple input field asking for an album id.', 'wp-photo-album-plus' ) . ' ' .
@@ -588,15 +589,19 @@ global $wppa_supported_camara_brands;
588
  $options_page_post = false;
589
  $values_page = false;
590
  $values_page_post = false;
 
591
  // First
592
  $options_page_post[] = __('--- the same page or post ---', 'wp-photo-album-plus');
593
  $values_page_post[] = '0';
594
  $options_page[] = __('--- please select a page ---', 'wp-photo-album-plus');
595
  $values_page[] = '0';
 
596
  // Pages if any
597
- $query = "SELECT ID, post_title, post_content, post_parent FROM " . $wpdb->posts . " WHERE post_type = 'page' AND post_status = 'publish' ORDER BY post_title ASC";
598
- $pages = $wpdb->get_results ($query, ARRAY_A);
599
- if ($pages) {
 
 
600
  if ( wppa_switch( 'hier_pagesel') ) $pages = wppa_add_parents($pages);
601
  else { // Just translate
602
  foreach ( array_keys($pages) as $index ) {
@@ -9503,8 +9508,10 @@ global $wppa_supported_camara_brands;
9503
  $help .= '<br />'.__('Or you may use the standard page on which you display the generic album.', 'wp-photo-album-plus');
9504
  $slug = 'wppa_search_linkpage';
9505
  wppa_verify_page($slug);
9506
- $query = "SELECT ID, post_title, post_content FROM " . $wpdb->posts . " WHERE post_type = 'page' AND post_status = 'publish' ORDER BY post_title ASC";
9507
- $pages = $wpdb->get_results($query, ARRAY_A);
 
 
9508
  $options = false;
9509
  $values = false;
9510
  $options[] = __('--- Please select a page ---', 'wp-photo-album-plus');
@@ -11035,7 +11042,9 @@ global $wppa_supported_camara_brands;
11035
 
11036
  $wppa_subtable = 'Z';
11037
 
11038
- $labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_iptc WHERE photo = '0' ORDER BY tag", ARRAY_A );
 
 
11039
  if ( is_array( $labels ) ) {
11040
  $i = '1';
11041
  foreach ( $labels as $label ) {
@@ -11044,10 +11053,10 @@ global $wppa_supported_camara_brands;
11044
  $help = '';
11045
  $slug1 = 'wppa_iptc_label_'.$name;
11046
  $slug2 = 'wppa_iptc_status_'.$name;
11047
- $html1 = wppa_edit($slug1, htmlentities( $label['description'] ) );
11048
  $options = array(__('Display', 'wp-photo-album-plus'), __('Hide', 'wp-photo-album-plus'), __('Optional', 'wp-photo-album-plus'));
11049
  $values = array('display', 'hide', 'option');
11050
- $html2 = wppa_select_e($slug2, htmlentities( $label['status'] ), $options, $values);
11051
  $html = array($html1, $html2);
11052
  $clas = '';
11053
  $tags = 'meta';
@@ -11103,7 +11112,9 @@ global $wppa_supported_camara_brands;
11103
  '<b></span>');
11104
  }
11105
 
11106
- $labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_exif WHERE photo = '0' ORDER BY tag", ARRAY_A );
 
 
11107
  if ( is_array( $labels ) ) {
11108
  $i = '1';
11109
  foreach ( $labels as $label ) {
@@ -11546,7 +11557,15 @@ global $wppa_totcols;
11546
  echo '
11547
  <td>' . $html . '</td>';
11548
  }
11549
-
 
 
 
 
 
 
 
 
11550
  // The helpbutton
11551
  if ( $helptext ) {
11552
  echo '
@@ -12175,7 +12194,10 @@ global $wppa_opt;
12175
  $slug = substr( $xslug, 5 );
12176
 
12177
  // If page vanished, update to 0
12178
- $iret = $wpdb->get_var($wpdb->prepare("SELECT COUNT(*) FROM " . $wpdb->posts . " WHERE post_type = 'page' AND post_status = 'publish' AND ID = %s", wppa_opt( $slug )));
 
 
 
12179
  if ( ! $iret ) {
12180
  wppa_update_option($slug, '0');
12181
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * manage all options
6
+ * Version 7.2.07
7
  *
8
  */
9
 
362
  'wp-deferred-javascripts/wp-deferred-javascripts.php',
363
  'frndzk-photo-lightbox-gallery/frndzk_photo_gallery.php',
364
  'simple-lightbox/main.php',
365
+ 'amp/amp.php',
366
  );
367
  $plugins = get_option('active_plugins');
368
  $matches = array_intersect($blacklist_plugins, $plugins);
409
 
410
  // Check for 'many' albums
411
  if ( wppa_opt( 'photo_admin_max_albums' ) ) { // Not OFF
412
+ $abs = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_albums" );
413
  if ( wppa_opt( 'photo_admin_max_albums' ) < $abs ) {
414
  wppa_warning_message( __( 'This system contains more albums than the maximum set in Table IX-B6.3.', 'wp-photo-album-plus' ) . ' ' .
415
  __( 'No problem, but some widgets may not work and some album selectionboxes will revert to a simple input field asking for an album id.', 'wp-photo-album-plus' ) . ' ' .
589
  $options_page_post = false;
590
  $values_page = false;
591
  $values_page_post = false;
592
+
593
  // First
594
  $options_page_post[] = __('--- the same page or post ---', 'wp-photo-album-plus');
595
  $values_page_post[] = '0';
596
  $options_page[] = __('--- please select a page ---', 'wp-photo-album-plus');
597
  $values_page[] = '0';
598
+
599
  // Pages if any
600
+ $pages = $wpdb->get_results( "SELECT ID, post_title, post_content, post_parent FROM $wpdb->posts
601
+ WHERE post_type = 'page'
602
+ AND post_status = 'publish'
603
+ ORDER BY post_title", ARRAY_A );
604
+ if ( $pages ) {
605
  if ( wppa_switch( 'hier_pagesel') ) $pages = wppa_add_parents($pages);
606
  else { // Just translate
607
  foreach ( array_keys($pages) as $index ) {
9508
  $help .= '<br />'.__('Or you may use the standard page on which you display the generic album.', 'wp-photo-album-plus');
9509
  $slug = 'wppa_search_linkpage';
9510
  wppa_verify_page($slug);
9511
+ $pages = $wpdb->get_results( "SELECT ID, post_title, post_content FROM $wpdb->posts
9512
+ WHERE post_type = 'page'
9513
+ AND post_status = 'publish'
9514
+ ORDER BY post_title", ARRAY_A );
9515
  $options = false;
9516
  $values = false;
9517
  $options[] = __('--- Please select a page ---', 'wp-photo-album-plus');
11042
 
11043
  $wppa_subtable = 'Z';
11044
 
11045
+ $labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_iptc
11046
+ WHERE photo = '0'
11047
+ ORDER BY tag", ARRAY_A );
11048
  if ( is_array( $labels ) ) {
11049
  $i = '1';
11050
  foreach ( $labels as $label ) {
11053
  $help = '';
11054
  $slug1 = 'wppa_iptc_label_'.$name;
11055
  $slug2 = 'wppa_iptc_status_'.$name;
11056
+ /**/ $html1 = wppa_edit($slug1, htmlentities( $label['description'] ));
11057
  $options = array(__('Display', 'wp-photo-album-plus'), __('Hide', 'wp-photo-album-plus'), __('Optional', 'wp-photo-album-plus'));
11058
  $values = array('display', 'hide', 'option');
11059
+ /**/ $html2 = wppa_select_e($slug2, htmlentities( $label['status'] ), $options, $values);
11060
  $html = array($html1, $html2);
11061
  $clas = '';
11062
  $tags = 'meta';
11112
  '<b></span>');
11113
  }
11114
 
11115
+ $labels = $wpdb->get_results( "SELECT * FROM $wpdb->wppa_exif
11116
+ WHERE photo = '0'
11117
+ ORDER BY tag", ARRAY_A );
11118
  if ( is_array( $labels ) ) {
11119
  $i = '1';
11120
  foreach ( $labels as $label ) {
11557
  echo '
11558
  <td>' . $html . '</td>';
11559
  }
11560
+ // For RIPS to see whre it complains about
11561
+ /*
11562
+ if ( isset( $htmls[0] ) ) echo '<td>' . $htmls[0] . '</td>';
11563
+ if ( isset( $htmls[1] ) ) echo '<td>' . $htmls[1] . '</td>';
11564
+ if ( isset( $htmls[2] ) ) echo '<td>' . $htmls[2] . '</td>';
11565
+ if ( isset( $htmls[3] ) ) echo '<td>' . $htmls[3] . '</td>';
11566
+ if ( isset( $htmls[4] ) ) echo '<td>' . $htmls[4] . '</td>';
11567
+ if ( isset( $htmls[5] ) ) echo '<td>' . $htmls[5] . '</td>';
11568
+ /**/
11569
  // The helpbutton
11570
  if ( $helptext ) {
11571
  echo '
12194
  $slug = substr( $xslug, 5 );
12195
 
12196
  // If page vanished, update to 0
12197
+ $iret = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->posts
12198
+ WHERE post_type = 'page'
12199
+ AND post_status = 'publish'
12200
+ AND ID = %s", wppa_opt( $slug )));
12201
  if ( ! $iret ) {
12202
  wppa_update_option($slug, '0');
12203
  }
wppa-styles.php CHANGED
@@ -3,7 +3,7 @@
3
  /* Package: wp-photo-album-plus
4
  /*
5
  /* Various style computation routines
6
- /* Version 7.2.06
7
  /*
8
  */
9
 
3
  /* Package: wp-photo-album-plus
4
  /*
5
  /* Various style computation routines
6
+ /* Version 7.2.07
7
  /*
8
  */
9
 
wppa-thumbnail-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail photos
6
- * Version 7.0.00
7
  */
8
 
9
  class ThumbnailWidget extends WP_Widget {
@@ -65,10 +65,19 @@ class ThumbnailWidget extends WP_Widget {
65
  }
66
 
67
  if ( $album ) {
68
- $thumbs = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status <> 'pending' AND status <> 'scheduled' AND album = %s ".$sortby." LIMIT %d", $album, $max ), 'ARRAY_A' );
 
 
 
 
 
69
  }
70
  else {
71
- $thumbs = $wpdb->get_results($wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE status <> 'pending' AND status <> 'scheduled'".$sortby." LIMIT %d", $max ), 'ARRAY_A' );
 
 
 
 
72
  }
73
 
74
  global $widget_content;
3
  * Package: wp-photo-album-plus
4
  *
5
  * display thumbnail photos
6
+ * Version 7.2.07
7
  */
8
 
9
  class ThumbnailWidget extends WP_Widget {
65
  }
66
 
67
  if ( $album ) {
68
+ $thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
69
+ WHERE status <> 'pending'
70
+ AND status <> 'scheduled'
71
+ AND album = %s " .
72
+ $sortby . "
73
+ LIMIT %d", $album, $max ), ARRAY_A );
74
  }
75
  else {
76
+ $thumbs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos
77
+ WHERE status <> 'pending'
78
+ AND status <> 'scheduled' " .
79
+ $sortby . "
80
+ LIMIT %d", $max ), ARRAY_A );
81
  }
82
 
83
  global $widget_content;
wppa-thumbnails.php CHANGED
@@ -5,7 +5,7 @@
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
- * Version 7.2.06
9
  *
10
  */
11
 
@@ -551,7 +551,11 @@ global $wpdb;
551
 
552
  // Single button voting system
553
  if ( wppa_opt( 'rating_max' ) == '1' && wppa_switch( 'vote_thumb' ) ) {
554
- $mylast = $wpdb->get_row( $wpdb->prepare( 'SELECT * FROM '.WPPA_RATING.' WHERE photo = %s AND user = %s ORDER BY id DESC LIMIT 1', $id, wppa_get_user() ), ARRAY_A );
 
 
 
 
555
 
556
  // Likes
557
  if ( wppa_opt( 'rating_display_type' ) == 'likes' ) {
@@ -739,7 +743,8 @@ global $wpdb;
739
 
740
  // Comcount
741
  if ( wppa_switch( 'thumb_text_comcount' ) ) {
742
- $comcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments WHERE photo = %d", $id ) );
 
743
  if ( $comcount ) {
744
  $result .= '<div' .
745
  ' class="wppa-thumb-text"' .
5
  * Various funcions to display a thumbnail image
6
  * Contains all possible frontend thumbnail types
7
  *
8
+ * Version 7.2.07
9
  *
10
  */
11
 
551
 
552
  // Single button voting system
553
  if ( wppa_opt( 'rating_max' ) == '1' && wppa_switch( 'vote_thumb' ) ) {
554
+ $mylast = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_rating
555
+ WHERE photo = %s
556
+ AND user = %s
557
+ ORDER BY id DESC
558
+ LIMIT 1", $id, wppa_get_user() ), ARRAY_A );
559
 
560
  // Likes
561
  if ( wppa_opt( 'rating_display_type' ) == 'likes' ) {
743
 
744
  // Comcount
745
  if ( wppa_switch( 'thumb_text_comcount' ) ) {
746
+ $comcount = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_comments
747
+ WHERE photo = %d", $id ) );
748
  if ( $comcount ) {
749
  $result .= '<div' .
750
  ' class="wppa-thumb-text"' .
wppa-tinymce-common.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-tinymce-common.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
- * Version 7.0.00
6
  *
7
  */
8
 
@@ -10,12 +10,11 @@ function wppa_make_tinymce_photo_dialog( $front = false ) {
10
  global $wpdb;
11
 
12
  // Prepare albuminfo
13
- $albums = $wpdb->get_results( "SELECT id, name " .
14
- "FROM $wpdb->wppa_albums " .
15
- "WHERE owner = '" . wppa_get_user() . "' " .
16
- "OR owner = '--- public ---' " .
17
- "ORDER BY name ",
18
- ARRAY_A );
19
 
20
  // Make the html
21
  // Open wrapper
@@ -332,11 +331,11 @@ global $wpdb;
332
  $result = '';
333
 
334
  // Prepare photoinfo
335
- $my_photos = $wpdb->get_results( "SELECT id, name, album, ext " .
336
- "FROM $wpdb->wppa_photos " .
337
- "WHERE owner = '" . wppa_get_user() . "' " .
338
- "ORDER BY timestamp DESC LIMIT 100",
339
- ARRAY_A );
340
 
341
  if ( $my_photos ) {
342
 
2
  /* wppa-tinymce-common.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
+ * Version 7.2.07
6
  *
7
  */
8
 
10
  global $wpdb;
11
 
12
  // Prepare albuminfo
13
+ $albums = $wpdb->get_results( $wpdb->prepare( "SELECT id, name
14
+ FROM $wpdb->wppa_albums
15
+ WHERE owner = %s
16
+ OR owner = '--- public ---'
17
+ ORDER BY name", wppa_get_user() ), ARRAY_A );
 
18
 
19
  // Make the html
20
  // Open wrapper
331
  $result = '';
332
 
333
  // Prepare photoinfo
334
+ $my_photos = $wpdb->get_results( $wpdb->prepare( "SELECT id, name, album, ext
335
+ FROM $wpdb->wppa_photos
336
+ WHERE owner = %s
337
+ ORDER BY timestamp DESC
338
+ LIMIT 100", wppa_get_user() ), ARRAY_A );
339
 
340
  if ( $my_photos ) {
341
 
wppa-tinymce-photo-front.php CHANGED
@@ -52,7 +52,11 @@ global $wppa_js_page_data;
52
  if ( wppa_switch( 'photo_shortcode_enabled' ) && ! $done ) {
53
 
54
  // Find an existing photo
55
- $id = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_photos WHERE ext <> 'xxx' AND panorama = 0 ORDER BY timestamp DESC LIMIT 1" );
 
 
 
 
56
 
57
  // Fake we are in a widget, to prevent wppa_get_picture_html() from bumping viewcount
58
  wppa( 'in_widget', true );
52
  if ( wppa_switch( 'photo_shortcode_enabled' ) && ! $done ) {
53
 
54
  // Find an existing photo
55
+ $id = $wpdb->get_var( "SELECT id FROM $wpdb->wppa_photos
56
+ WHERE ext <> 'xxx'
57
+ AND panorama = 0
58
+ ORDER BY timestamp DESC
59
+ LIMIT 1" );
60
 
61
  // Fake we are in a widget, to prevent wppa_get_picture_html() from bumping viewcount
62
  wppa( 'in_widget', true );
wppa-tinymce-shortcodes.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-tinymce-shortcodes.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
- * Version 7.1.11
6
  */
7
 
8
  if ( ! defined( 'ABSPATH' ) )
@@ -73,7 +73,8 @@ global $wpdb;
73
  $albums = null;
74
  }
75
  else {
76
- $albums = $wpdb->get_results( "SELECT id, name FROM $wpdb->wppa_albums ORDER BY timestamp DESC", ARRAY_A );
 
77
  if ( wppa_switch( 'hier_albsel' ) ) {
78
  $albums = wppa_add_paths( $albums );
79
  $albums = wppa_array_sort( $albums, 'name' );
@@ -81,18 +82,20 @@ global $wpdb;
81
  }
82
 
83
  // Prepare photoinfo
84
- $photos = $wpdb->get_results( "SELECT id, name, album, ext FROM $wpdb->wppa_photos ORDER BY timestamp DESC LIMIT 100", ARRAY_A );
 
 
 
85
 
86
  // Get Tags/cats
87
  $tags = wppa_get_taglist();
88
  $cats = wppa_get_catlist();
89
 
90
  // Pages suitable for landing
91
- $query = "SELECT ID, post_title, post_content, post_parent " .
92
- "FROM " . $wpdb->posts . " " .
93
- "WHERE post_type = 'page' AND post_status = 'publish' " .
94
- "ORDER BY post_title ASC";
95
- $pages = $wpdb->get_results( $query, ARRAY_A );
96
 
97
  if ( $pages ) {
98
 
2
  /* wppa-tinymce-shortcodes.php
3
  * Pachkage: wp-photo-album-plus
4
  *
5
+ * Version 7.2.07
6
  */
7
 
8
  if ( ! defined( 'ABSPATH' ) )
73
  $albums = null;
74
  }
75
  else {
76
+ $albums = $wpdb->get_results( "SELECT id, name FROM $wpdb->wppa_albums
77
+ ORDER BY timestamp DESC", ARRAY_A );
78
  if ( wppa_switch( 'hier_albsel' ) ) {
79
  $albums = wppa_add_paths( $albums );
80
  $albums = wppa_array_sort( $albums, 'name' );
82
  }
83
 
84
  // Prepare photoinfo
85
+ $photos = $wpdb->get_results( "SELECT id, name, album, ext
86
+ FROM $wpdb->wppa_photos
87
+ ORDER BY timestamp DESC
88
+ LIMIT 100", ARRAY_A );
89
 
90
  // Get Tags/cats
91
  $tags = wppa_get_taglist();
92
  $cats = wppa_get_catlist();
93
 
94
  // Pages suitable for landing
95
+ $pages = $wpdb->get_results( "SELECT ID, post_title, post_content, post_parent FROM $wpdb->posts
96
+ WHERE post_type = 'page'
97
+ AND post_status = 'publish'
98
+ ORDER BY post_title", ARRAY_A );
 
99
 
100
  if ( $pages ) {
101
 
wppa-upldr-widget.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
- * Version 7.0.00
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
@@ -63,10 +63,18 @@ class UpldrWidget extends WP_Widget {
63
  }
64
  else {
65
  if ( $instance['parent'] ) {
66
- $query = $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE owner = %s AND album IN (".$selalbs.") AND ( ( status <> 'pending' AND status <> 'scheduled' ) OR owner = %s )", $user['user_login'], $me );//);
 
 
 
 
67
  }
68
  else {
69
- $query = $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE owner = %s AND ( ( status <> 'pending' AND status <> 'scheduled' ) OR owner = %s )", $user['user_login'], $me );//);
 
 
 
 
70
  }
71
  $photo_count = $wpdb->get_var( $query );
72
  if ( $user['user_login'] != $me ) {
@@ -78,10 +86,20 @@ class UpldrWidget extends WP_Widget {
78
  if ( $user['user_login'] != $me && isset ( $upldrcache[$this->get_widget_id()][$user['user_login']]['d'] ) ) $last_dtm = $upldrcache[$this->get_widget_id()][$user['user_login']]['d'];
79
  else {
80
  if ( $instance['parent'] ) {
81
- $last_dtm = $wpdb->get_var($wpdb->prepare( "SELECT timestamp FROM $wpdb->wppa_photos WHERE owner = %s AND album IN (".$selalbs.") AND ( ( status <> 'pending' AND status <> 'scheduled' ) OR owner = %s ) ORDER BY timestamp DESC LIMIT 1", $user['user_login'], $me ));
 
 
 
 
 
82
  }
83
  else {
84
- $last_dtm = $wpdb->get_var($wpdb->prepare( "SELECT timestamp FROM $wpdb->wppa_photos WHERE owner = %s AND ( ( status <> 'pending' AND status <> 'scheduled' ) OR owner = %s ) ORDER BY timestamp DESC LIMIT 1", $user['user_login'], $me ));
 
 
 
 
 
85
  }
86
  }
87
  if ( $user['user_login'] != $me ) {
3
  * Package: wp-photo-album-plus
4
  *
5
  * display a list of users linking to their photos
6
+ * Version 7.2.07
7
  */
8
 
9
  if ( ! defined( 'ABSPATH' ) ) die( "Can't load this file directly" );
63
  }
64
  else {
65
  if ( $instance['parent'] ) {
66
+ $query = $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos
67
+ WHERE owner = %s
68
+ AND album IN (".$selalbs.")
69
+ AND ( ( status <> 'pending' AND status <> 'scheduled' )
70
+ OR owner = %s )", $user['user_login'], $me );
71
  }
72
  else {
73
+ $query = $wpdb->prepare( "SELECT COUNT(*)
74
+ FROM $wpdb->wppa_photos
75
+ WHERE owner = %s
76
+ AND ( ( status <> 'pending' AND status <> 'scheduled' )
77
+ OR owner = %s )", $user['user_login'], $me );
78
  }
79
  $photo_count = $wpdb->get_var( $query );
80
  if ( $user['user_login'] != $me ) {
86
  if ( $user['user_login'] != $me && isset ( $upldrcache[$this->get_widget_id()][$user['user_login']]['d'] ) ) $last_dtm = $upldrcache[$this->get_widget_id()][$user['user_login']]['d'];
87
  else {
88
  if ( $instance['parent'] ) {
89
+ $last_dtm = $wpdb->get_var($wpdb->prepare( "SELECT timestamp FROM $wpdb->wppa_photos
90
+ WHERE owner = %s AND album IN (".$selalbs.")
91
+ AND ( ( status <> 'pending' AND status <> 'scheduled' )
92
+ OR owner = %s )
93
+ ORDER BY timestamp DESC
94
+ LIMIT 1", $user['user_login'], $me ));
95
  }
96
  else {
97
+ $last_dtm = $wpdb->get_var($wpdb->prepare( "SELECT timestamp FROM $wpdb->wppa_photos
98
+ WHERE owner = %s
99
+ AND ( ( status <> 'pending' AND status <> 'scheduled' )
100
+ OR owner = %s )
101
+ ORDER BY timestamp DESC
102
+ LIMIT 1", $user['user_login'], $me ));
103
  }
104
  }
105
  if ( $user['user_login'] != $me ) {
wppa-upload-common.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
- * Version 7.2.06
7
  *
8
  */
9
 
@@ -48,15 +48,6 @@ global $wppa_supported_document_extensions;
48
  // See if this filename (except extension) already exists in this album
49
  $ext_type = '';
50
  $ext_id = wppa_is_file_alias( $file['name'], $album );
51
- /*
52
- $ext_id = $wpdb->get_var( $wpdb->prepare( "SELECT id
53
- FROM $wpdb->wppa_photos
54
- WHERE filename LIKE %s
55
- AND album = %d",
56
- $wpdb->esc_like( wppa_strip_ext( $file['name'] ) ) . '.%',
57
- $album
58
- ) );
59
- */
60
 
61
  if ( $ext_id ) {
62
  $ext_ext = wppa_get_ext( wppa_get_photo_item( $ext_id, 'filename' ) );
@@ -284,10 +275,10 @@ global $wppa_supported_document_extensions;
284
  while ( $i < count( $names ) -1 ) {
285
 
286
  // Find album with parent is current and name is subalbum name
287
- $a = $wpdb->get_var( $wpdb->prepare( "SELECT `id`
288
  FROM $wpdb->wppa_albums
289
- WHERE `name` = %s
290
- AND `a_parent` = %d
291
  LIMIT 1", $names[$i], $p ) );
292
 
293
  // If not found, create it
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains common upload functions
6
+ * Version 7.2.07
7
  *
8
  */
9
 
48
  // See if this filename (except extension) already exists in this album
49
  $ext_type = '';
50
  $ext_id = wppa_is_file_alias( $file['name'], $album );
 
 
 
 
 
 
 
 
 
51
 
52
  if ( $ext_id ) {
53
  $ext_ext = wppa_get_ext( wppa_get_photo_item( $ext_id, 'filename' ) );
275
  while ( $i < count( $names ) -1 ) {
276
 
277
  // Find album with parent is current and name is subalbum name
278
+ $a = $wpdb->get_var( $wpdb->prepare( "SELECT id
279
  FROM $wpdb->wppa_albums
280
+ WHERE name = %s
281
+ AND a_parent = %d
282
  LIMIT 1", $names[$i], $p ) );
283
 
284
  // If not found, create it
wppa-upload-widget.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * A wppa widget to upload photos
6
  *
7
- * Version 6.9.21
8
  */
9
 
10
  class WppaUploadWidget extends WP_Widget {
@@ -34,7 +34,8 @@ class WppaUploadWidget extends WP_Widget {
34
  $title = apply_filters( 'widget_title', $instance['title'] );
35
  $album = $instance['album'];
36
 
37
- if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE id = %d", $album ) ) ) {
 
38
  $album = '0'; // Album vanished
39
  }
40
 
4
  *
5
  * A wppa widget to upload photos
6
  *
7
+ * Version 7.2.07
8
  */
9
 
10
  class WppaUploadWidget extends WP_Widget {
34
  $title = apply_filters( 'widget_title', $instance['title'] );
35
  $album = $instance['album'];
36
 
37
+ if ( ! $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
38
+ WHERE id = %d", $album ) ) ) {
39
  $album = '0'; // Album vanished
40
  }
41
 
wppa-users.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
- * Version 7.0.10
7
  *
8
  */
9
 
@@ -15,7 +15,7 @@ global $wpdb;
15
  static $usercount;
16
 
17
  if ( empty( $usercount ) ) {
18
- $usercount = $wpdb->get_var( "SELECT COUNT(*) FROM " . $wpdb->users . "" );
19
  }
20
 
21
  return $usercount;
@@ -31,8 +31,8 @@ static $users;
31
  $users = array();
32
  }
33
  else {
34
- $users = $wpdb->get_results( "SELECT * FROM ".$wpdb->users." " .
35
- "ORDER BY display_name", ARRAY_A );
36
  }
37
  }
38
  return $users;
@@ -145,7 +145,8 @@ global $wp_roles;
145
 
146
  // If logged out max set, check if limit reached
147
  if ( $rmax ) {
148
- $albs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE owner = %s", wppa_get_user() ) );
 
149
  if ( $albs >= $rmax ) {
150
  return false; // Limit reached
151
  }
@@ -172,7 +173,8 @@ global $wp_roles;
172
  }
173
 
174
  // Check for global max albums per user setting
175
- $albs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums WHERE owner = %s", wppa_get_user() ) );
 
176
  $gmax = wppa_opt( 'max_albums' );
177
  if ( $gmax && $albs >= $gmax ) {
178
  return false;
@@ -246,9 +248,8 @@ static $result = -1;
246
  }
247
 
248
  if ( is_numeric( $user ) ) {
249
- $user = $wpdb->get_var( $wpdb->prepare(
250
- "SELECT user_login FROM ".$wpdb->users." WHERE ID = %d", $user
251
- ) );
252
  }
253
  else {
254
  return false;
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains user and capabilities related routines
6
+ * Version 7.2.07
7
  *
8
  */
9
 
15
  static $usercount;
16
 
17
  if ( empty( $usercount ) ) {
18
+ $usercount = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->users" );
19
  }
20
 
21
  return $usercount;
31
  $users = array();
32
  }
33
  else {
34
+ $users = $wpdb->get_results( "SELECT * FROM $wpdb->users
35
+ ORDER BY display_name", ARRAY_A );
36
  }
37
  }
38
  return $users;
145
 
146
  // If logged out max set, check if limit reached
147
  if ( $rmax ) {
148
+ $albs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
149
+ WHERE owner = %s", wppa_get_user() ) );
150
  if ( $albs >= $rmax ) {
151
  return false; // Limit reached
152
  }
173
  }
174
 
175
  // Check for global max albums per user setting
176
+ $albs = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_albums
177
+ WHERE owner = %s", wppa_get_user() ) );
178
  $gmax = wppa_opt( 'max_albums' );
179
  if ( $gmax && $albs >= $gmax ) {
180
  return false;
248
  }
249
 
250
  if ( is_numeric( $user ) ) {
251
+ $user = $wpdb->get_var( $wpdb->prepare( "SELECT user_login FROM $wpdb->users
252
+ WHERE ID = %d", $user ) );
 
253
  }
254
  else {
255
  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.2.06.009
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 = '7206'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.2.06.009'; // 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.07.006
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 = '7207'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.2.07.006'; // WPPA software version
27
 
28
  /* Init page js data */
29
  global $wppa_js_page_data; $wppa_js_page_data = '';