WP Photo Album Plus - Version 7.0.12.003

Version Description

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

Code changes from version 7.0.11.004 to 7.0.12.003

changelog.txt CHANGED
@@ -1,5 +1,13 @@
1
  WP Photo Album Plus Changelog
2
 
 
 
 
 
 
 
 
 
3
  = 7.0.11 =
4
 
5
  * Fixed a js warning related to google maps api loading.
1
  WP Photo Album Plus Changelog
2
 
3
+ = 7.0.12 =
4
+
5
+ * Update addressline with pretty urls issued a problem on the homepage. Fixed.
6
+ * Fixed a problem where non admin users tried to delete their own album.
7
+ * Fixed an issue with respect to the parent album selection box.
8
+ * Treecounts were not updated after a pdf upload. Fixed.
9
+ * Added name slugs on the album and photo admin pages. These names will be used in urls, if names in urls configured.
10
+
11
  = 7.0.11 =
12
 
13
  * Fixed a js warning related to google maps api loading.
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.0.11
6
  Stable tag: 7.0.10.008
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
@@ -139,6 +139,10 @@ See for the full changelog: <a href="http://www.wppa.nl/changelog/" >The documen
139
 
140
  = 7.0.11 =
141
 
 
 
 
 
142
  * This version addresses various bug fixes
143
 
144
  = 7.0.10 =
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.0.12
6
  Stable tag: 7.0.10.008
7
  Author: J.N. Breetvelt
8
  Author URI: http://www.opajaap.nl/
139
 
140
  = 7.0.11 =
141
 
142
+ * This version addresses various bug fixes and feature requests.
143
+
144
+ = 7.0.11 =
145
+
146
  * This version addresses various bug fixes
147
 
148
  = 7.0.10 =
wppa-ajax.php CHANGED
@@ -2,7 +2,7 @@
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
- * Version 7.0.10
6
  *
7
  */
8
 
@@ -19,6 +19,13 @@ global $wppa_log_file;
19
  wppa( 'ajax', true );
20
  wppa( 'error', '0' );
21
  wppa( 'out', '' );
 
 
 
 
 
 
 
22
  $wppa_session['page']--;
23
  $wppa_session['ajax']++;
24
 
@@ -2369,7 +2376,7 @@ global $wppa_log_file;
2369
  $filename = wppa_get_photo_item( $photo, 'filename' );
2370
  // If very old, no filename, take new name
2371
  if ( ! $filename ) {
2372
- $filename = wppa_sima( $_FILES['photo']['name'] );
2373
  wppa_update_photo( array( 'id' => $photo, 'filename' => $filename ) );
2374
  }
2375
  wppa_save_source( $_FILES['photo']['tmp_name'], $filename, wppa_get_photo_item( $photo, 'album') );
2
  /* wppa-ajax.php
3
  *
4
  * Functions used in ajax requests
5
+ * Version 7.0.12
6
  *
7
  */
8
 
19
  wppa( 'ajax', true );
20
  wppa( 'error', '0' );
21
  wppa( 'out', '' );
22
+ if ( ! isset( $wppa_session['page'] ) ) {
23
+ wppa_session_start();
24
+ }
25
+ if ( ! isset( $wppa_session['page'] ) ) {
26
+ $wppa_session['page'] = '0';
27
+ $wppa_session['ajax'] = '0';
28
+ }
29
  $wppa_session['page']--;
30
  $wppa_session['ajax']++;
31
 
2376
  $filename = wppa_get_photo_item( $photo, 'filename' );
2377
  // If very old, no filename, take new name
2378
  if ( ! $filename ) {
2379
+ $filename = sanitize_file_name( $_FILES['photo']['name'] );
2380
  wppa_update_photo( array( 'id' => $photo, 'filename' => $filename ) );
2381
  }
2382
  wppa_save_source( $_FILES['photo']['tmp_name'], $filename, wppa_get_photo_item( $photo, 'album') );
wppa-album-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
- * Version 7.0.05
7
  *
8
  */
9
 
@@ -293,6 +293,7 @@ global $wppa_revno;
293
  $cats = stripslashes( trim( $albuminfo['cats'], ',' ) );
294
  $default_tags = trim( $albuminfo['default_tags'], ',' );
295
  $cover_linktype = $albuminfo['cover_linktype'];
 
296
 
297
  $treecounts = wppa_get_treecounts_a( $id, true );
298
  $pviews = $treecounts['selfphotoviews'];
@@ -520,6 +521,7 @@ global $wppa_revno;
520
  wppa_album_select_a( array( 'checkaccess' => true,
521
  'exclude' => $id,
522
  'selected' => $a_parent,
 
523
  'addselected' => true,
524
  'disableancestors' => true,
525
  'path' => wppa_switch( 'hier_albsel' ),
@@ -743,6 +745,9 @@ global $wppa_revno;
743
  <span class="description" >' .
744
  __( 'Type the name of the album. Do not leave this empty.', 'wp-photo-album-plus' ) . '
745
  </span>
 
 
 
746
  </td>
747
  <td>
748
  </td>
@@ -2553,8 +2558,16 @@ global $wpdb;
2553
  function wppa_del_album( $id, $move = '-9' ) {
2554
  global $wpdb;
2555
 
2556
- if ( $move && ! wppa_have_access( $move ) ) {
2557
- wppa_error_message(__('Unable to move photos to album %s. Album not deleted.', 'wp-photo-album-plus'));
 
 
 
 
 
 
 
 
2558
  return false;
2559
  }
2560
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * create, edit and delete albums
6
+ * Version 7.0.12
7
  *
8
  */
9
 
293
  $cats = stripslashes( trim( $albuminfo['cats'], ',' ) );
294
  $default_tags = trim( $albuminfo['default_tags'], ',' );
295
  $cover_linktype = $albuminfo['cover_linktype'];
296
+ $sname = $albuminfo['sname'];
297
 
298
  $treecounts = wppa_get_treecounts_a( $id, true );
299
  $pviews = $treecounts['selfphotoviews'];
521
  wppa_album_select_a( array( 'checkaccess' => true,
522
  'exclude' => $id,
523
  'selected' => $a_parent,
524
+ 'addnone' => wppa_can_create_top_album(),
525
  'addselected' => true,
526
  'disableancestors' => true,
527
  'path' => wppa_switch( 'hier_albsel' ),
745
  <span class="description" >' .
746
  __( 'Type the name of the album. Do not leave this empty.', 'wp-photo-album-plus' ) . '
747
  </span>
748
+ <span style="float:right;" >' .
749
+ __( 'Name slug', 'wp-photo-album-plus' ) . ': ' . $sname . '
750
+ </span>
751
  </td>
752
  <td>
753
  </td>
2558
  function wppa_del_album( $id, $move = '-9' ) {
2559
  global $wpdb;
2560
 
2561
+ if ( $move > 0 && ! wppa_have_access( $move ) ) {
2562
+ wppa_error_message( sprintf( __( 'Unable to move photos to album %s. Album not deleted.', 'wp-photo-album-plus' ), $move ) );
2563
+ return false;
2564
+ }
2565
+
2566
+ if ( wppa_user_is( 'administrator' ) || wppa_get_album_item( $id, 'owner' ) == wppa_get_user() ) {
2567
+ // Ok to delete
2568
+ }
2569
+ else {
2570
+ wppa_error_message( sprintf( __( 'You do not have sufficient rights to delete album %s. Album not deleted.', 'wp-photo-album-plus' ), $id ) );
2571
  return false;
2572
  }
2573
 
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.0.11
6
  *
7
  */
8
 
@@ -999,32 +999,18 @@ global $wppa;
999
  return $result;
1000
  }
1001
 
1002
-
1003
  function wppa_table_exists( $xtable ) {
1004
  global $wpdb;
1005
  static $tables;
1006
 
1007
- // Some sqls do not show tables, benefit of the doubt: assume table exists
1008
- if ( $tables === false ) return true;
1009
-
1010
- if ( empty( $tables ) ) {
1011
- $tables = $wpdb->get_results( "SHOW TABLES FROM ".DB_NAME."", ARRAY_A );
1012
- }
1013
-
1014
  if ( empty( $tables ) ) {
1015
- $tables = false;
1016
- return true;
1017
  }
1018
 
1019
- // Normal check
1020
- foreach ( $tables as $table ) {
1021
- if ( is_array( $table ) ) foreach ( $table as $item ) {
1022
- if ( strcasecmp( $item, $xtable ) == 0 ) return true;
1023
- }
1024
- }
1025
- return false;
1026
  }
1027
-
1028
 
1029
 
1030
  function wppa_clear_cache( $force = false ) {
2
  /* wppa-common-functions.php
3
  *
4
  * Functions used in admin and in themes
5
+ * Version 7.0.12
6
  *
7
  */
8
 
999
  return $result;
1000
  }
1001
 
1002
+ /*
1003
  function wppa_table_exists( $xtable ) {
1004
  global $wpdb;
1005
  static $tables;
1006
 
 
 
 
 
 
 
 
1007
  if ( empty( $tables ) ) {
1008
+ $tables = $wpdb->get_results( "SHOW TABLES FROM `" . DB_NAME . "`", ARRAY_A );
 
1009
  }
1010
 
1011
+ return in_array( $xtable, $tables );
 
 
 
 
 
 
1012
  }
1013
+ */
1014
 
1015
 
1016
  function wppa_clear_cache( $force = false ) {
wppa-functions.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
- * Version 7.0.11
7
  *
8
  */
9
 
@@ -1118,7 +1118,7 @@ global $wppa_session;
1118
  wppa_cache_album( 'add', $albums );
1119
  }
1120
 
1121
- wppa( 'album_count', count( $albums ) );
1122
  return $albums;
1123
  }
1124
 
@@ -4507,7 +4507,7 @@ global $wppa_supported_audio_extensions;
4507
  global $wppa_alert;
4508
 
4509
  // Log upload attempt
4510
- wppa_log( 'Upl', 'FE Upload attempt of file ' . wppa_sima( $file['name'] ) . ', size=' . filesize( $file['tmp_name'] ) );
4511
 
4512
  $album = wppa_cache_album( $alb );
4513
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Various functions
6
+ * Version 7.0.12
7
  *
8
  */
9
 
1118
  wppa_cache_album( 'add', $albums );
1119
  }
1120
 
1121
+ wppa( 'album_count', ( $albums ? count( $albums ) : 0 ) );
1122
  return $albums;
1123
  }
1124
 
4507
  global $wppa_alert;
4508
 
4509
  // Log upload attempt
4510
+ wppa_log( 'Upl', 'FE Upload attempt of file ' . sanitize_file_name( $file['name'] ) . ', size=' . filesize( $file['tmp_name'] ) );
4511
 
4512
  $album = wppa_cache_album( $alb );
4513
 
wppa-init.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
- * Version 7.0.04
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
@@ -59,6 +59,7 @@ require_once 'wppa-tinymce-common.php';
59
  require_once 'wppa-local-cdn.php';
60
  require_once 'wppa-wrappers.php';
61
  require_once 'wppa-mailing.php';
 
62
 
63
  /* Required for widget displays at back-end */
64
  require_once 'wppa-links.php';
4
  *
5
  * This file loads required php files and contains all functions used in init actions.
6
  *
7
+ * Version 7.0.12
8
  */
9
 
10
  /* LOAD SIDEBAR WIDGETS */
59
  require_once 'wppa-local-cdn.php';
60
  require_once 'wppa-wrappers.php';
61
  require_once 'wppa-mailing.php';
62
+ require_once 'wppa-upload-common.php';
63
 
64
  /* Required for widget displays at back-end */
65
  require_once 'wppa-links.php';
wppa-links.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
- * Version 7.0.10
7
  *
8
  */
9
 
@@ -299,13 +299,13 @@ function wppa_get_slideshow_url_ajax($id, $page = '') {
299
  function wppa_convert_from_pretty( $uri ) {
300
 
301
  // Is it a compressed pretty link?
302
- if ( strpos( $uri, '-' ) ) {
303
  $uri = wppa_decompress_pretty( $uri );
304
  }
305
 
306
  // Is a pretty link given?
307
  $wppapos = stripos( $uri, '/wppaspec/' );
308
- if ( ! $wppapos ) return $uri;
309
 
310
  // Works only on non-default permalinks
311
  if ( ! get_option( 'permalink_structure' ) ) return $uri;
@@ -484,21 +484,6 @@ function wppa_convert_to_pretty( $xuri, $no_names = false, $overrule = false ) {
484
  $amps = false;
485
  }
486
  $parts = explode( '?', $uri );
487
-
488
- // If is_front_page(), redirection will fail
489
- // During ajax, is_front_page() returns always false
490
- // So we test on home_url()
491
- if ( $parts[0] == home_url() ) {
492
-
493
- // return original, optionally wppa_ trimmed and album names.
494
- if ( ! $no_names ) {
495
- return wppa_album_number_to_name_in_uri( wppa_trim_wppa_( $xuri ) );
496
- }
497
- else {
498
- return wppa_trim_wppa_( $xuri );
499
- }
500
- }
501
-
502
  $args = explode( '&', $parts[1] );
503
  $order = array( 'occur', 'woccur',
504
  'searchstring',
@@ -707,7 +692,7 @@ function wppa_convert_to_pretty( $xuri, $no_names = false, $overrule = false ) {
707
  function wppa_decompress_pretty( $uri ) {
708
 
709
  // Is it a compressed pretty url?
710
- if ( ! strpos( $uri, '/-/' ) ) {
711
  return $uri;
712
  }
713
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Frontend links
6
+ * Version 7.0.12
7
  *
8
  */
9
 
299
  function wppa_convert_from_pretty( $uri ) {
300
 
301
  // Is it a compressed pretty link?
302
+ if ( strpos( $uri, '-' ) !== false ) {
303
  $uri = wppa_decompress_pretty( $uri );
304
  }
305
 
306
  // Is a pretty link given?
307
  $wppapos = stripos( $uri, '/wppaspec/' );
308
+ if ( $wppapos === false ) return $uri;
309
 
310
  // Works only on non-default permalinks
311
  if ( ! get_option( 'permalink_structure' ) ) return $uri;
484
  $amps = false;
485
  }
486
  $parts = explode( '?', $uri );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
487
  $args = explode( '&', $parts[1] );
488
  $order = array( 'occur', 'woccur',
489
  'searchstring',
692
  function wppa_decompress_pretty( $uri ) {
693
 
694
  // Is it a compressed pretty url?
695
+ if ( strpos( $uri, '/-/' ) === false ) {
696
  return $uri;
697
  }
698
 
wppa-mailing.php CHANGED
@@ -4,7 +4,7 @@
4
  *
5
  * Contains mailing functions
6
  *
7
- * Version 7.0.10
8
  *
9
  */
10
 
@@ -53,7 +53,7 @@ global $wpdb;
53
  'commentapproved',
54
  );
55
 
56
- while ( ! wppa_is_time_up() ) {
57
  foreach( $mailings as $list ) {
58
  if ( substr( $list, 0, 8 ) != 'moderate' || user_can( $i, 'wppa_moderate' ) ) {
59
  wppa_subscribe_user( $i, $list );
4
  *
5
  * Contains mailing functions
6
  *
7
+ * Version 7.0.12
8
  *
9
  */
10
 
53
  'commentapproved',
54
  );
55
 
56
+ while ( ! wppa_is_time_up() && $i <= $to ) {
57
  foreach( $mailings as $list ) {
58
  if ( substr( $list, 0, 8 ) != 'moderate' || user_can( $i, 'wppa_moderate' ) ) {
59
  wppa_subscribe_user( $i, $list );
wppa-maintenance.php CHANGED
@@ -944,7 +944,7 @@ global $wppa_endtime;
944
  wppa_log( 'Cron', 'Could not complete scan of index item # {b}' . $indexes[$idx]['id'] . '{/b},' .
945
  ' slug = {b}' . $indexes[$idx]['slug'] . '{/b},' .
946
  ' count = {b}' . $cp . '{/b},' .
947
- ' photo id = {b}' . $pho .'{/b},' .
948
  ' next element # = {b}' . $pidx . '{/b},'
949
  );
950
  $aborted = true;
944
  wppa_log( 'Cron', 'Could not complete scan of index item # {b}' . $indexes[$idx]['id'] . '{/b},' .
945
  ' slug = {b}' . $indexes[$idx]['slug'] . '{/b},' .
946
  ' count = {b}' . $cp . '{/b},' .
947
+ ' photo id = {b}' . $photos[$pidx] .'{/b},' .
948
  ' next element # = {b}' . $pidx . '{/b},'
949
  );
950
  $aborted = true;
wppa-non-admin.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
- * Version 7.0.09
7
  *
8
  */
9
 
@@ -398,10 +398,10 @@ global $wppa_opt;
398
  // google maps
399
  if ( ( wppa_switch( 'load_map_api' ) || wppa_opt( 'gpx_implementation' ) == 'wppa-plus-embedded' ) && strpos( wppa_opt( 'custom_content' ), 'w#location' ) !== false ) {
400
  $key = wppa_opt( 'map_apikey' );
401
- wp_enqueue_script( 'wppa-geo',
402
- 'https://maps.googleapis.com/maps/api/js?' . ( $key ? 'key=' . $key : 'v=3.exp' ),
403
- '',
404
- $wppa_api_version,
405
  $footer );
406
  }
407
 
@@ -748,9 +748,16 @@ function wppa_redirect() {
748
  if ( ! isset( $_SERVER["REQUEST_URI"] ) ) return;
749
 
750
  $uri = $_SERVER["REQUEST_URI"];
751
- $wppapos = stripos( $uri, '/wppaspec/' ) || ( strpos( $uri, '/-/' ) && get_option( 'wppa_use_pretty_links' ) == 'compressed' );
 
752
 
753
- if ( $wppapos && get_option('permalink_structure') ) {
 
 
 
 
 
 
754
 
755
  // old style solution, still required when qTranslate is active
756
  $plugins = implode( ',', get_option( 'active_plugins' ) );
@@ -765,7 +772,7 @@ function wppa_redirect() {
765
  }
766
 
767
  // New style solution
768
- $newuri = wppa_convert_from_pretty($uri);
769
  if ( $newuri == $uri ) return;
770
  $_SERVER["REQUEST_URI"] = $newuri;
771
  wppa_convert_uri_to_get( $newuri );
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the non admin stuff
6
+ * Version 7.0.12
7
  *
8
  */
9
 
398
  // google maps
399
  if ( ( wppa_switch( 'load_map_api' ) || wppa_opt( 'gpx_implementation' ) == 'wppa-plus-embedded' ) && strpos( wppa_opt( 'custom_content' ), 'w#location' ) !== false ) {
400
  $key = wppa_opt( 'map_apikey' );
401
+ wp_enqueue_script( 'wppa-geo',
402
+ 'https://maps.googleapis.com/maps/api/js?' . ( $key ? 'key=' . $key : 'v=3.exp' ),
403
+ '',
404
+ $wppa_api_version,
405
  $footer );
406
  }
407
 
748
  if ( ! isset( $_SERVER["REQUEST_URI"] ) ) return;
749
 
750
  $uri = $_SERVER["REQUEST_URI"];
751
+ $wppapos = stripos( $uri, '/wppaspec/' );
752
+ if ( $wppapos === false ) {
753
 
754
+ $wppapos = strpos( $uri, '/-/' );
755
+ if ( get_option( 'wppa_use_pretty_links' ) != 'compressed' ) {
756
+ $wppapos = false;
757
+ }
758
+ }
759
+
760
+ if ( $wppapos !== false && get_option( 'permalink_structure' ) ) {
761
 
762
  // old style solution, still required when qTranslate is active
763
  $plugins = implode( ',', get_option( 'active_plugins' ) );
772
  }
773
 
774
  // New style solution
775
+ $newuri = wppa_convert_from_pretty( $uri );
776
  if ( $newuri == $uri ) return;
777
  $_SERVER["REQUEST_URI"] = $newuri;
778
  wppa_convert_uri_to_get( $newuri );
wppa-photo-admin-autosave.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
- * Version 7.0.07
7
  *
8
  */
9
 
@@ -528,6 +528,7 @@ function wppaToggleExif( id, count ) {
528
  $magickstack = $photo['magickstack'];
529
  $scheduledel = $photo['scheduledel'];
530
  $ext = $photo['ext'];
 
531
 
532
  // See if item is a multimedia item
533
  $is_multi = wppa_is_multi( $id );
@@ -1716,9 +1717,9 @@ function wppaToggleExif( id, count ) {
1716
  echo
1717
  '<tr>' .
1718
  '<td>' .
1719
- __( 'Photoname:' , 'wp-photo-album-plus') .
1720
- '</td>' .
1721
- '<td>' .
1722
  '<input' .
1723
  ' type="text"' .
1724
  ' style="width:100%;"' .
@@ -1726,8 +1727,12 @@ function wppaToggleExif( id, count ) {
1726
  ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' .
1727
  ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' .
1728
  ' value="' . esc_attr( stripslashes( $name ) ) . '"' .
1729
- ' />' .
1730
- '</td>' .
 
 
 
 
1731
  '<td>' .
1732
  '</td>' .
1733
  '</tr>';
3
  * Package: wp-photo-album-plus
4
  *
5
  * edit and delete photos
6
+ * Version 7.0.12
7
  *
8
  */
9
 
528
  $magickstack = $photo['magickstack'];
529
  $scheduledel = $photo['scheduledel'];
530
  $ext = $photo['ext'];
531
+ $sname = $photo['sname'];
532
 
533
  // See if item is a multimedia item
534
  $is_multi = wppa_is_multi( $id );
1717
  echo
1718
  '<tr>' .
1719
  '<td>' .
1720
+ __( 'Photoname:' , 'wp-photo-album-plus') . '
1721
+ </td>
1722
+ <td>' .
1723
  '<input' .
1724
  ' type="text"' .
1725
  ' style="width:100%;"' .
1727
  ' onkeyup="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' .
1728
  ' onchange="wppaAjaxUpdatePhoto( ' . $id . ', \'name\', this );"' .
1729
  ' value="' . esc_attr( stripslashes( $name ) ) . '"' .
1730
+ ' />
1731
+ <br />
1732
+ <span style="float:right;" >' .
1733
+ __( 'Name slug', 'wp-photo-album-plus' ) . ': ' . $sname . '
1734
+ </span>
1735
+ </td>' .
1736
  '<td>' .
1737
  '</td>' .
1738
  '</tr>';
wppa-session.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all session routines
6
- * Version 7.0.01
7
  *
8
  * Firefox modifies data in the superglobal $_SESSION.
9
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
@@ -28,10 +28,13 @@ function wppa_session_start() {
28
  global $wpdb;
29
  global $wppa_session;
30
 
31
- // If the session table does not yet exist on activation
32
- if ( is_admin() && ! wppa_table_exists( WPPA_SESSION ) ) {
33
- $wppa_session['id'] = '0';
34
- return false;
 
 
 
35
  }
36
 
37
  $lifetime = 3600; // Sessions expire after one hour
@@ -190,7 +193,7 @@ static $last_query;
190
  if ( ! isset( $wppa_session['id'] ) ) return false;
191
 
192
  // To prevent data overflow, only save the most recent 100 urls
193
- $c = is_array( $wppa_session['uris'] ) ? count( $wppa_session['uris'] ) : 0;
194
  if ( $c > 100 ) {
195
  array_shift( $wppa_session['uris'] );
196
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all session routines
6
+ * Version 7.0.12
7
  *
8
  * Firefox modifies data in the superglobal $_SESSION.
9
  * See https://bugzilla.mozilla.org/show_bug.cgi?id=991019
28
  global $wpdb;
29
  global $wppa_session;
30
 
31
+ // If the session table does not yet exist on activation the first time
32
+ if ( is_admin() ) {
33
+ $tables = $wpdb->get_results( "SHOW TABLES FROM `" . DB_NAME . "`", ARRAY_A );
34
+ if ( ! in_array( WPPA_SESSION, $tables ) ) {
35
+ $wppa_session['id'] = '0';
36
+ return false;
37
+ }
38
  }
39
 
40
  $lifetime = 3600; // Sessions expire after one hour
193
  if ( ! isset( $wppa_session['id'] ) ) return false;
194
 
195
  // To prevent data overflow, only save the most recent 100 urls
196
+ $c = isset( $wppa_session['uris'] ) && is_array( $wppa_session['uris'] ) ? count( $wppa_session['uris'] ) : 0;
197
  if ( $c > 100 ) {
198
  array_shift( $wppa_session['uris'] );
199
  }
wppa-setup.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
- * Version 7.0.10
7
  *
8
  */
9
 
@@ -192,16 +192,16 @@ global $wppa_error;
192
  $tc = array( $create_albums, $create_photos, $create_rating, $create_comments, $create_iptc, $create_exif, $create_index, $create_session );
193
  $idx = 0;
194
  while ($idx < 8) {
195
- $a0 = wppa_table_exists($tn[$idx]);
196
  dbDelta($tc[$idx]);
197
- $a1 = wppa_table_exists($tn[$idx]);
198
- if ( WPPA_DEBUG ) {
199
- if ( ! $a0 ) {
200
- if ( $a1 ) wppa_ok_message('Database table '.$tn[$idx].' created.');
201
- else wppa_error_message('Could not create database table '.$tn[$idx]);
202
- }
203
- else wppa_ok_message('Database table '.$tn[$idx].' updated.');
204
- }
205
  $idx++;
206
  }
207
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the setup stuff
6
+ * Version 7.0.12
7
  *
8
  */
9
 
192
  $tc = array( $create_albums, $create_photos, $create_rating, $create_comments, $create_iptc, $create_exif, $create_index, $create_session );
193
  $idx = 0;
194
  while ($idx < 8) {
195
+ // $a0 = wppa_ table_exists($tn[$idx]);
196
  dbDelta($tc[$idx]);
197
+ // $a1 = wppa_ table_exists($tn[$idx]);
198
+ // if ( WPPA_DEBUG ) {
199
+ // if ( ! $a0 ) {
200
+ // if ( $a1 ) wppa_log('dbg', 'Database table '.$tn[$idx].' created.');
201
+ // else wppa_log('dbg', 'Could not create database table '.$tn[$idx]);
202
+ // }
203
+ // else wppa_log('dbg', 'Database table '.$tn[$idx].' updated.');
204
+ // }
205
  $idx++;
206
  }
207
 
wppa-upload-common.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* wppa-upload-common.php
3
+ * Package: wp-photo-album-plus
4
+ *
5
+ * Contains common upload functions
6
+ * Version 7.0.12
7
+ *
8
+ */
9
+
10
+ // Upload a single item; an element form $_FILES
11
+ // @1: Array( 'name' => the original filename,
12
+ // 'tmp_name' => the path to the just uploaded file or a file somewhere else in the filesystem )
13
+ // @2: Text: 'boxA', 'boxB', 'front', 'import'
14
+ function wppa_upload_one_item( $file, $album, $from = '' ) {
15
+ global $wpdb;
16
+
17
+ // Check arg
18
+ if ( ! is_array( $file ) ) {
19
+ wppa_error_message( __( 'Unexpected internal error in wppa_upload_one_item()', 'wp-photo-album-plus' ) . ' ' . $from );
20
+ return;
21
+ }
22
+
23
+ // Save some data and sanitize som data
24
+ wppa( 'unsanitized_filename', $file['name'] );
25
+ $file['name'] = wppa_down_ext( $file['name'] );
26
+ $file['name'] = wppa_sanitize_album_photo_name( $file['name'] );
27
+
28
+ $the_type = wppa_get_ext( $file['name'] );
29
+ $existing = $wpdb->get_var( $wpdb->prepare( "SELECT id
30
+ FROM $wpdb->wppa_photos
31
+ WHERE filename LIKE %s
32
+ AND album = %d",
33
+ $wpdb->esc_like( wppa_strip_ext( $file['name'] ) ) . '.%',
34
+ $album
35
+ ) );
36
+
37
+ // Dispatch on filetype
38
+ switch ( $the_type ) {
39
+
40
+ case 'pdf':
41
+
42
+ // Move .pdf to source dir and try to make a poster image .jpg file
43
+ wppa_pdf_preprocess( $file, $album );
44
+
45
+ // See if poster image is creted by imagick, i.e. $file['tmp_name'] has been replaced by a .jpg
46
+ if ( file_exists( $file['tmp_name'] ) ) {
47
+ $id = wppa_create_photo_entry( array( 'album' => $album,
48
+ 'ext' => 'jpg',
49
+ 'name' => $file['name'],
50
+ 'filename' => wppa_strip_ext( $file['name'] ) . '.pdf',
51
+ 'sname' => $file['name'],
52
+ ) );
53
+ wppa_copy( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
54
+ wppa_cache_photo( 'invalidate', $id );
55
+ wppa_make_the_photo_files( wppa_get_source_album_dir( $album ) . '/' . $file['name'], $id, 'jpg' );
56
+ }
57
+
58
+ // No poster file created by imagick
59
+ else {
60
+ $id = wppa_create_photo_entry( array( 'album' => $album,
61
+ 'ext' => 'pdf',
62
+ 'name' => $file['name'],
63
+ 'filename' => wppa_strip_ext( $file['name'] ) . '.pdf',
64
+ 'sname' => $file['name'],
65
+ ) );
66
+ }
67
+ wppa( 'is_pdf', false );
68
+
69
+ // Update treecounts
70
+ wppa_invalidate_treecounts( $album );
71
+
72
+ return true; // Yes we uploaded a file
73
+ break;
74
+
75
+ case 'jpg':
76
+ case 'jpeg':
77
+ case 'png':
78
+ case 'gif':
79
+
80
+ // Poster file?
81
+ if ( $existing ) {
82
+ $pdf_poster = wppa_is_pdf( $existing );
83
+ $multi_poster = wppa_is_multi( $existing );
84
+ }
85
+ else {
86
+ $pdf_poster = false;
87
+ $multi_poster = false;
88
+ }
89
+
90
+ // Process posterfile
91
+ if ( $pdf_poster || $multi_poster ) {
92
+ wppa_move_uploaded_file( $file['tmp_name'], wppa_get_source_album_dir( $album ) . '/' . $file['name'] );
93
+ if ( $pdf_poster ) {
94
+ echo 'Updating '.$existing.', '.$file['name'].' '.$the_type;
95
+ wppa_update_photo( array( 'id' => $existing, 'ext' => $the_type ) );
96
+ }
97
+ wppa_cache_photo( 'invalidate', $existing );
98
+ wppa_make_the_photo_files( wppa_get_source_album_dir( $album ) . '/' . $file['name'], $existing, wppa_get_ext( $file['name'] ) );
99
+ return true;
100
+ }
101
+
102
+ // Just a photo
103
+ $id = wppa_insert_photo( $file['tmp_name'], $album, $file['name'] );
104
+ if ( $id ) {
105
+ return true;
106
+ }
107
+ else {
108
+ wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'] ) ) . '.' );
109
+ return false;
110
+ }
111
+ break;
112
+
113
+ default:
114
+ wppa_error_message( __( 'Unsupported filetype encountered', 'wp-photo-album-plus' ) . ': ' . $the_type );
115
+ }
116
+ }
wppa-upload.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
- * Version 7.0.11
7
  *
8
  */
9
 
@@ -545,9 +545,8 @@ global $upload_album;
545
  '</div>';
546
  }
547
 
548
- // Upload multiple photos
549
  function wppa_upload_multiple() {
550
- global $wpdb;
551
  global $warning_given;
552
  global $upload_album;
553
 
@@ -555,143 +554,58 @@ global $upload_album;
555
  $uploaded_a_file = false;
556
 
557
  $count = '0';
558
- foreach ( $_FILES as $file ) {
559
- if ( is_array( $file['error'] ) ) {
560
- for ( $i = '0'; $i < count( $file['error'] ); $i++ ) {
561
- if ( wppa_is_time_up() ) {
562
- wppa_warning_message( sprintf( __( 'Time out. %s photos uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
563
- wppa_set_last_album( $upload_album );
564
- return;
565
- }
566
- if ( ! $file['error'][$i] ) {
567
- $file['name'][$i] = wppa_down_ext( $file['name'][$i] );
568
- $file['name'][$i] = str_replace( ' ', '-', $file['name'][$i] );
569
- wppa( 'unsanitized_filename', $file['name'][$i] );
570
- wppa_pdf_preprocess( $file, $upload_album, $i );
571
-
572
- // Could not craete poster image
573
- if ( wppa( 'is_pdf' ) && ! file_exists( $file['tmp_name'][$i] ) ) {
574
- $id = wppa_create_photo_entry( array( 'album' => $upload_album,
575
- 'ext' => 'pdf',
576
- 'name' => $file['name'][$i],
577
- 'filename' => wppa_strip_ext( $file['name'][$i] ) . '.pdf',
578
- ) );
579
- $uploaded_a_file = true;
580
- $count++;
581
- wppa( 'is_pdf', false );
582
- }
583
 
584
- // Could create poster image or is no pdf
585
- else {
586
-
587
- // Are we uploading a posterfile for a pdf?
588
- $id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$wpdb->wppa_photos}
589
- WHERE filename = %s
590
- AND album = %d",
591
- wppa_strip_ext( $file['name'][$i] ) . '.pdf',
592
- $upload_album
593
- ) );
594
- if ( $id ) {
595
- wppa_move_uploaded_file( $file['tmp_name'][$i], wppa_get_source_album_dir( $upload_album ) . '/' . $file['name'][$i] );
596
- wppa_update_photo( array( 'id' => $id, 'ext' => wppa_get_ext( $file['name'][$i] ) ) );
597
- wppa_cache_photo( 'invalidate', $id );
598
- wppa_make_the_photo_files( wppa_get_source_album_dir( $upload_album ) . '/' . $file['name'][$i], $id, wppa_get_ext( $file['name'][$i] ) );
599
- $uploaded_a_file = true;
600
- $count++;
601
- }
602
-
603
- // No, just a photo
604
- else {
605
- $id = wppa_insert_photo( $file['tmp_name'][$i], $upload_album, $file['name'][$i] );
606
- if ( $id ) {
607
- $uploaded_a_file = true;
608
- $count++;
609
- wppa_pdf_postprocess( $id );
610
- }
611
- else {
612
- wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( wppa_sima( basename( $file['name'][$i] ) ) ) . '.' );
613
- return;
614
- }
615
- }
616
- }
617
- }
618
  }
619
  }
620
  }
621
 
622
- if ( $uploaded_a_file ) {
623
  wppa_update_message( $count.' '.__( 'Photos Uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
624
  wppa_set_last_album( $upload_album );
625
  }
626
  }
627
 
628
- // Upload single photos
629
  function wppa_upload_photos() {
630
- global $wpdb;
631
  global $warning_given;
632
  global $upload_album;
633
 
634
-
635
  $warning_given = false;
636
- $uploaded_a_file = false;
637
 
638
  $count = '0';
639
  foreach ( $_FILES as $file ) {
640
- if ( $file['tmp_name'] != '' ) {
641
- $file['name'] = wppa_down_ext( $file['name'] );
642
- $file['name'] = str_replace( ' ', '-', $file['name'] );
643
- wppa( 'unsanitized_filename', $file['name'] );
644
- wppa_pdf_preprocess( $file, $upload_album );
645
-
646
- // Could not craete poster image
647
- if ( wppa( 'is_pdf' ) && ! file_exists( $file['tmp_name'] ) ) {
648
- $id = wppa_create_photo_entry( array( 'album' => $upload_album,
649
- 'ext' => 'pdf',
650
- 'name' => $file['name'],
651
- 'filename' => wppa_strip_ext( $file['name'] ) . '.pdf',
652
- ) );
653
- $uploaded_a_file = true;
654
  $count++;
655
- wppa( 'is_pdf', false );
656
  }
 
657
 
658
- // Could create poster image or is no pdf
659
- else {
660
-
661
- // Are we uploading a posterfile for a pdf?
662
- $id = $wpdb->get_var( $wpdb->prepare( "SELECT id FROM {$wpdb->wppa_photos}
663
- WHERE filename = %s
664
- AND album = %d",
665
- wppa_strip_ext( $file['name'] ) . '.pdf',
666
- $upload_album
667
- ) );
668
- if ( $id ) {
669
- wppa_move_uploaded_file( $file['tmp_name'], wppa_get_source_album_dir( $upload_album ) . '/' . $file['name'] );
670
- wppa_update_photo( array( 'id' => $id, 'ext' => wppa_get_ext( $file['name'] ) ) );
671
- wppa_cache_photo( 'invalidate', $id );
672
- wppa_make_the_photo_files( wppa_get_source_album_dir( $upload_album ) . '/' . $file['name'], $id, wppa_get_ext( $file['name'] ) );
673
- $uploaded_a_file = true;
674
- $count++;
675
- }
676
-
677
- // No, just a photo
678
- else {
679
- $id = wppa_insert_photo( $file['tmp_name'], $upload_album, $file['name'] );
680
- if ( $id ) {
681
- $uploaded_a_file = true;
682
- $count++;
683
- wppa_pdf_postprocess( $id );
684
- }
685
- else {
686
- wppa_error_message( __( 'Error inserting photo' , 'wp-photo-album-plus') . ' ' . wppa_sanitize_file_name( basename( $file['name'] ) ) . '.' );
687
- return;
688
- }
689
- }
690
- }
691
  }
692
  }
693
 
694
- if ( $uploaded_a_file ) {
695
  wppa_update_message( $count.' '.__( 'Photos Uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
696
  wppa_set_last_album( $upload_album );
697
  }
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains all the upload pages and functions
6
+ * Version 7.0.12
7
  *
8
  */
9
 
545
  '</div>';
546
  }
547
 
548
+ // Upload multiple photos Box A
549
  function wppa_upload_multiple() {
 
550
  global $warning_given;
551
  global $upload_album;
552
 
554
  $uploaded_a_file = false;
555
 
556
  $count = '0';
557
+ foreach( $_FILES as $the_file ) { // Usually only one item: $_FILES['my_file']
558
+ for ( $i = '0'; $i < count( $the_file['error'] ); $i++ ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
559
 
560
+ $file = array( 'error' => $the_file['error'][$i],
561
+ 'tmp_name' => $the_file['tmp_name'][$i],
562
+ 'name' => $the_file['name'][$i],
563
+ 'type' => $the_file['type'][$i],
564
+ 'size' => $the_file['size'][$i],
565
+ );
566
+
567
+ if ( wppa_upload_one_item( $file, $upload_album, 'boxA' ) ) {
568
+ $count++;
569
+ }
570
+
571
+ if ( wppa_is_time_up() ) {
572
+ wppa_warning_message( sprintf( __( 'Time out. %s photos uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
573
+ wppa_set_last_album( $upload_album );
574
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
575
  }
576
  }
577
  }
578
 
579
+ if ( $count ) {
580
  wppa_update_message( $count.' '.__( 'Photos Uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
581
  wppa_set_last_album( $upload_album );
582
  }
583
  }
584
 
585
+ // Upload single photos Box B
586
  function wppa_upload_photos() {
 
587
  global $warning_given;
588
  global $upload_album;
589
 
 
590
  $warning_given = false;
 
591
 
592
  $count = '0';
593
  foreach ( $_FILES as $file ) {
594
+
595
+ if ( $file['name'] ) {
596
+ if ( wppa_upload_one_item( $file, $upload_album, 'boxB' ) ) {
 
 
 
 
 
 
 
 
 
 
 
597
  $count++;
 
598
  }
599
+ }
600
 
601
+ if ( wppa_is_time_up() ) {
602
+ wppa_warning_message( sprintf( __( 'Time out. %s photos uploaded in album nr %s.' , 'wp-photo-album-plus'), $count, $upload_album ) );
603
+ wppa_set_last_album( $upload_album );
604
+ return;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
605
  }
606
  }
607
 
608
+ if ( $count ) {
609
  wppa_update_message( $count.' '.__( 'Photos Uploaded in album nr' , 'wp-photo-album-plus') . ' ' . $upload_album );
610
  wppa_set_last_album( $upload_album );
611
  }
wppa-utils.php CHANGED
@@ -3,7 +3,7 @@
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
- * Version 7.0.11
7
  *
8
  */
9
 
@@ -1984,6 +1984,9 @@ global $blog_id;
1984
  $blog = '';
1985
  }
1986
  $source_album_dir = wppa_opt( 'source_dir' ).$blog.'/album-'.$alb;
 
 
 
1987
 
1988
  return $source_album_dir;
1989
  }
@@ -4526,70 +4529,32 @@ function wppa_is_windows() {
4526
  }
4527
 
4528
  // If it is a pdf, do preprocessing. We mod &file, hence &$file
4529
- function wppa_pdf_preprocess( &$file, $alb, $i = false ) {
4530
 
4531
  // If pdf not enabled, nothing to do.
4532
  if ( ! wppa_switch( 'enable_pdf' ) ) return;
4533
 
4534
- // Is it a pdf?
4535
- if ( $i === false ) {
4536
- $is_pdf = wppa_get_ext( wppa_sima( $file['name'] ) ) == 'pdf';
4537
- $single = true;
4538
- }
4539
-
4540
- // One file out of a multiple upload
4541
- else {
4542
- $is_pdf = wppa_get_ext( wppa_sima( $file['name'][$i] ) ) == 'pdf';
4543
- $single = false;
4544
- }
4545
-
4546
  // Only continue if this is a pdf
4547
- if ( ! $is_pdf ) {
4548
- return;
4549
- }
4550
 
4551
- // Make sure there are no spaces in the filename, otherwise the download link is broken
4552
- // Needs to be done only when imagick is not active because filename will be sanitized in that case
4553
- if ( ! wppa_opt( 'image_magick' ) ) {
4554
- if ( $single ) {
4555
- $file['name'] = str_replace( ' ', '-', $file['name'] );
4556
- }
4557
- else {
4558
- $file['name'][$i] = str_replace( ' ', '-', $file['name'][$i] );
4559
- }
4560
- }
4561
 
4562
  // Copy pdf to source dir,
4563
  $src = wppa_get_source_album_dir( $alb );
4564
- if ( ! wppa_is_dir( $src ) ) {
4565
- wppa_mkdir( $src );
4566
- }
4567
- $src .= '/';
4568
-
4569
- if ( $single ) {
4570
- wppa_copy( $file['tmp_name'], $src . sanitize_file_name( basename( $file['name'] ) ) );
4571
- }
4572
- else {
4573
- wppa_copy( $file['tmp_name'][$i], $src . sanitize_file_name( basename( $file['name'][$i] ) ) );
4574
- }
4575
 
4576
  // Make it a jpg in the source dir,
4577
- if ( $single ) {
4578
- $pdf = sanitize_file_name( basename( $file['name'] ) );
4579
- }
4580
- else {
4581
- $pdf = sanitize_file_name( basename( $file['name'][$i] ) );
4582
- }
4583
  $jpg = wppa_strip_ext( $pdf ) . '.jpg';
4584
-
4585
- $err = wppa_image_magick( 'convert -limit thread 1 ' . $src . $pdf . ' -background white -alpha deactivate -scene 1 ' . $src . $jpg );
4586
 
4587
  // Log what we did
4588
  if ( $err ) {
4589
- wppa_log( 'fso', 'Imagick failed to create ' . $src . $jpg );
4590
  }
4591
  else {
4592
- wppa_log( 'fso', 'Imagick Created ' . $src . $jpg );
4593
  }
4594
 
4595
  // Report imagemagick coud not create posterfile
@@ -4608,23 +4573,13 @@ function wppa_pdf_preprocess( &$file, $alb, $i = false ) {
4608
 
4609
  // Copy the jpg image back to the wppa/temp/ folder and update $file['tmp_name'] to point to it
4610
  else {
4611
- if ( $single ) {
4612
- $file['name'] = $jpg;
4613
- $to = WPPA_UPLOAD_PATH . '/temp/' . basename( $file['tmp_name'] );
4614
- wppa_copy( $src . $jpg, $to );
4615
- $file['tmp_name'] = $to;
4616
- }
4617
- else {
4618
- $file['name'][$i] = $jpg;
4619
- $to = WPPA_UPLOAD_PATH . '/temp/' . basename( $file['tmp_name'][$i] );
4620
- wppa_copy( $src . $jpg, $to );
4621
- $file['tmp_name'][$i] = $to;
4622
- }
4623
  }
4624
 
4625
- // and continue as if it was a jpg, but remember its a .pdf
4626
  wppa( 'is_pdf', true );
4627
-
4628
  return;
4629
  }
4630
 
@@ -4795,15 +4750,6 @@ function wppa_remote_file_exists( $url ) {
4795
  return false;
4796
  }
4797
 
4798
- // Sanitize filename when imagemagick is active
4799
- function wppa_sima( $filename ) {
4800
-
4801
- if ( wppa_opt( 'image_magick' ) ) {
4802
- $filename = sanitize_file_name( $filename );
4803
- }
4804
- return $filename;
4805
- }
4806
-
4807
  // Rename all files inside a tree to their sanitized name (recursive)
4808
  function wppa_rename_files_sanitized( $root ) {
4809
 
3
  * Package: wp-photo-album-plus
4
  *
5
  * Contains low-level utility routines
6
+ * Version 7.0.12
7
  *
8
  */
9
 
1984
  $blog = '';
1985
  }
1986
  $source_album_dir = wppa_opt( 'source_dir' ).$blog.'/album-'.$alb;
1987
+ if ( ! wppa_is_dir( $source_album_dir ) ) {
1988
+ wppa_mkdir( $source_album_dir );
1989
+ }
1990
 
1991
  return $source_album_dir;
1992
  }
4529
  }
4530
 
4531
  // If it is a pdf, do preprocessing. We mod &file, hence &$file
4532
+ function wppa_pdf_preprocess( &$file, $alb ) {
4533
 
4534
  // If pdf not enabled, nothing to do.
4535
  if ( ! wppa_switch( 'enable_pdf' ) ) return;
4536
 
 
 
 
 
 
 
 
 
 
 
 
 
4537
  // Only continue if this is a pdf
4538
+ if ( wppa_get_ext( $file['name'] ) != 'pdf' ) return;
 
 
4539
 
4540
+ // Sanitize filename
4541
+ $file['name'] = wppa_sanitize_album_photo_name( $file['name'] );
 
 
 
 
 
 
 
 
4542
 
4543
  // Copy pdf to source dir,
4544
  $src = wppa_get_source_album_dir( $alb );
4545
+ wppa_move_uploaded_file( $file['tmp_name'], $src . '/' . $file['name'] );
 
 
 
 
 
 
 
 
 
 
4546
 
4547
  // Make it a jpg in the source dir,
4548
+ $pdf = $file['name'];
 
 
 
 
 
4549
  $jpg = wppa_strip_ext( $pdf ) . '.jpg';
4550
+ $err = wppa_image_magick( 'convert -limit thread 1 ' . $src . '/' . $pdf . ' -background white -alpha deactivate -scene 1 ' . $src . '/' . $jpg );
 
4551
 
4552
  // Log what we did
4553
  if ( $err ) {
4554
+ wppa_log( 'fso', 'Imagick failed to create ' . $src . '/' . $jpg );
4555
  }
4556
  else {
4557
+ wppa_log( 'fso', 'Imagick Created ' . $src . '/' . $jpg );
4558
  }
4559
 
4560
  // Report imagemagick coud not create posterfile
4573
 
4574
  // Copy the jpg image back to the wppa/temp/ folder and update $file['tmp_name'] to point to it
4575
  else {
4576
+ $file['name'] = $jpg;
4577
+ $to = WPPA_UPLOAD_PATH . '/temp/' . basename( $file['tmp_name'] );
4578
+ wppa_copy( $src . '/' . $jpg, $to );
4579
+ $file['tmp_name'] = $to;
 
 
 
 
 
 
 
 
4580
  }
4581
 
 
4582
  wppa( 'is_pdf', true );
 
4583
  return;
4584
  }
4585
 
4750
  return false;
4751
  }
4752
 
 
 
 
 
 
 
 
 
 
4753
  // Rename all files inside a tree to their sanitized name (recursive)
4754
  function wppa_rename_files_sanitized( $root ) {
4755
 
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.0.11.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/
@@ -22,8 +22,8 @@ global $wpdb;
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
- global $wppa_revno; $wppa_revno = '7010'; // WPPA db version
26
- global $wppa_api_version; $wppa_api_version = '7.0.11.004'; // WPPA software version
27
 
28
  /* start timers */
29
  add_action( 'plugins_loaded', 'wppa_init_timer' );
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.0.12.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/
22
  global $wp_version;
23
 
24
  /* WPPA GLOBALS */
25
+ global $wppa_revno; $wppa_revno = '7012'; // WPPA db version
26
+ global $wppa_api_version; $wppa_api_version = '7.0.12.003'; // WPPA software version
27
 
28
  /* start timers */
29
  add_action( 'plugins_loaded', 'wppa_init_timer' );