Below is a differential between the unpatched vulnerable code and the patched update, for reference.
--- a/wp-photo-album-plus/wppa-admin-functions.php
+++ b/wp-photo-album-plus/wppa-admin-functions.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* gp admin functions
-* Version: 9.3.00.001
+* Version: 9.3.08.001
*
*/
@@ -684,22 +684,20 @@
}
// If not dups allowed and its already here, quit
- if ( wppa_get( 'nodups' ) || wppa_switch( 'void_dups' ) ) {
- $exists = wppa_is_file_duplicate_photo( $filename, $alb );
- if ( $exists ) {
- if ( wppa_get( 'del-after-p' ) ) {
- wppa_unlink( $file );
- /* translators: photoname, albumname */
- $msg = __( 'Photo %1$s already exists in album number %2$s. Removed from depot.', 'wp-photo-album-plus' );
- }
- else {
- /* translators: photoname, albumname */
- $msg = __( 'Photo %1$s already exists in album number %2$s.', 'wp-photo-album-plus' );
- }
- wppa_warning_message( sprintf( $msg, $name, $alb ) );
- wppa_log( 'war', sprintf( $msg, $name, $alb ));
- return false;
+ $exists = wppa_is_file_duplicate_photo( $filename, $alb );
+ if ( $exists ) {
+ if ( wppa_get( 'del-after-p' ) ) {
+ wppa_unlink( $file );
+ /* translators: photoname, albumname */
+ $msg = __( 'Photo %1$s already exists in album number %2$s. Removed from depot.', 'wp-photo-album-plus' );
}
+ else {
+ /* translators: photoname, albumname */
+ $msg = __( 'Photo %1$s already exists in album number %2$s.', 'wp-photo-album-plus' );
+ }
+ wppa_warning_message( sprintf( $msg, $name, $alb ) );
+ wppa_log( 'war', sprintf( $msg, $name, $alb ));
+ return false;
}
// Verify file exists
--- a/wp-photo-album-plus/wppa-ajax.php
+++ b/wp-photo-album-plus/wppa-ajax.php
@@ -2,7 +2,7 @@
/* wppa-ajax.php
*
* Functions used in ajax requests
-* Version: 9.3.07.001
+* Version: 9.3.08.001
*
*/
@@ -2674,7 +2674,7 @@
// Check for already exists
$exists = wppa_is_file_duplicate_photo( $photodata['filename'], $toalb );
- if ( wppa_switch( 'void_dups' ) && $exists ) {
+ if ( $exists ) {
/* translators: file name, album id */
$txt = sprintf ( __( 'A photo with filename %1$s already exists in album %2$d.' , 'wp-photo-album-plus' ), $photodata['filename'], $toalb );
@@ -2716,7 +2716,7 @@
// Check for already exists
$exists = wppa_is_file_duplicate_photo( $photodata['filename'], $toalb );
- if ( wppa_switch( 'void_dups' ) && $exists ) {
+ if ( $exists ) {
/* translators: photo filename, album id */
$txt = sprintf( __( 'A photo with filename %1$s already exists in album %2$d.' , 'wp-photo-album-plus' ), $photodata['filename'], $toalb );
--- a/wp-photo-album-plus/wppa-boxes-html.php
+++ b/wp-photo-album-plus/wppa-boxes-html.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Various wppa boxes
-* Version 9.3.06.002
+* Version 9.3.08.001
*
*/
@@ -4091,7 +4091,7 @@
class="wppa-comment-bquote"
style="padding:5px 0;margin:5px 0 0;width:98%;"
>' .
- wp_kses_post( convert_smilies( $c ) ) . '
+ esc_html( esc_js( wp_kses_post( convert_smilies( $c ) ) ) ) . '
</blockquote>';
// Status approved
@@ -4657,22 +4657,19 @@
$count++;
$newtag = $iptcline['tag'];
- if ( $newtag != $oldtag && $oldtag != '' ) $result .= '</td></tr>'; // Close previous line
- if ( $newtag == $oldtag ) {
- $result .= '; '; // next item with same tag
- }
- else {
+ if ( $newtag != $oldtag ) { // Ignore dups
$result .= '
<tr style="border-bottom:0 none; border-top:0 none; border-left: 0 none; border-right: 0 none">
<td class="wppa-iptc-label wppa-box-text wppa-td" style="width:50%;text-align:right">' .
esc_js( wppa_translate( $label ) ) . '
</td>
<td class="wppa-iptc-value wppa-box-text wppa-td" style="width:50%;text-align:left">';
+ $result .= esc_js( wppa_sanitize_text( wppa_translate( $iptcline['description'], 'wp-photo-album-plus' ) ) ) . '
+ </td>
+ </tr>';
}
- $result .= esc_js( wppa_sanitize_text( wppa_translate( $iptcline['description'], 'wp-photo-album-plus' ) ) );
$oldtag = $newtag;
}
- if ( $oldtag != '' ) $result .= '</td></tr>'; // Close last line
$result .= '</tbody></table></div>';
}
if ( ! $count ) {
@@ -4758,6 +4755,7 @@
$oldtag = '';
foreach ( $exifdata as $exifline ) {
+ $newtag = $exifline['tag'];
$default = 'default';
$label = '';
foreach ( $wppa_exif_labels as $exif_label ) {
@@ -4778,24 +4776,19 @@
$count++;
$newtag = $exifline['tag'];
- if ( $newtag != $oldtag && $oldtag != '' ) $result .= '</td></tr>'; // Close previous line
- if ( $newtag == $oldtag ) {
- $result .= '; '; // next item with same tag
- }
- else {
- $result .= '<tr style="border-bottom:0 none; border-top:0 none; border-left: 0 none; border-right: 0 none">' .
- '<td class="wppa-exif-label wppa-box-text wppa-td" style="width:50%;text-align:right">';
-
- $label = rtrim( wppa_exif_tagname( $exifline['tag'], $brand ), " nrtv :" );
-
- $result .= esc_js( wppa_translate( $label ) );
-
- $result .= '</td><td class="wppa-exif-value wppa-box-text wppa-td" style="width:50%;text-align:left">';
+ if ( $newtag != $oldtag ) { // Ignore dups
+ $result .=
+ '<tr style="border-bottom:0 none; border-top:0 none; border-left: 0 none; border-right: 0 none">
+ <td class="wppa-exif-label wppa-box-text wppa-td" style="width:50%;text-align:right">' .
+ esc_js( wppa_translate( rtrim( wppa_exif_tagname( $exifline['tag'], $brand ), " nrtv :" ) ) ) . '
+ </td>
+ <td class="wppa-exif-value wppa-box-text wppa-td" style="width:50%;text-align:left">' .
+ esc_js( $exifline['f_description'] ) . '
+ </td>
+ </tr>';
}
- $result .= esc_js( $exifline['f_description'] );
$oldtag = $newtag;
}
- if ( $oldtag != '' ) $result .= '</td></tr>'; // Close last line
$result .= '</tbody></table></div>';
}
if ( ! $count ) {
--- a/wp-photo-album-plus/wppa-defaults.php
+++ b/wp-photo-album-plus/wppa-defaults.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains default settings
-* version 9.3.06.001
+* version 9.3.08.001
*
*/
@@ -846,7 +846,6 @@
'wppa_user_destroy_on' => 'no',
'wppa_upload_frontend_minsize' => 0,
'wppa_upload_frontend_maxsize' => 0,
- 'wppa_void_dups' => 'no',
'wppa_fe_alert' => 'all',
'wppa_fe_upload_max_albums' => 500, // VII-B13
--- a/wp-photo-album-plus/wppa-exif-iptc-common.php
+++ b/wp-photo-album-plus/wppa-exif-iptc-common.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* exif and iptc common functions
-* Version: 9.3.05.002
+* Version: 9.3.08.001
*
*
*/
@@ -61,10 +61,7 @@
}
}
- if ( $prevtag == $tag ) { // add a next item for this tag
- $combined .= ', '.htmlspecialchars( wp_strip_all_tags( $iptcline['description'] ) );
- }
- else { // first item of this tag
+ if ( $prevtag != $tag ) { // Ignore dups
if ( $combined ) { // Process if required
$temp = str_replace( $prevtag, $combined, $temp );
}
@@ -146,10 +143,7 @@
foreach ( $exifdata as $exifline ) {
$tag = $exifline['tag'];
- if ( $prevtag == $tag ) { // add a next item for this tag
- $combined .= ', ' . wppa_format_exif( $tag, $exifline['description'] );
- }
- else { // first item of this tag
+ if ( $prevtag != $tag ) { // Ignore dups
if ( $combined ) { // Process if required
$temp = str_replace( $prevtag, $combined, $temp );
}
--- a/wp-photo-album-plus/wppa-filter.php
+++ b/wp-photo-album-plus/wppa-filter.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* get the albums via shortcode handler
-* Version: 9.3.07.001
+* Version: 9.3.08.001
*
*/
@@ -168,7 +168,7 @@
$wppa['portrait'] = $atts['portrait'];
$wppa['anon'] = $atts['anon'];
$wppa['meonly'] = $atts['meonly'];
- $wppa['container-wrapper-class'] = $atts['class'];
+ $wppa['container-wrapper-class'] = wppa_alphadec( $atts['class'] );
$wppa['targetmocc'] = $atts['targetmocc'];
$wppa['is_random'] = $atts['random'];
$wppa['max'] = $atts['max'];
@@ -682,7 +682,7 @@
break;
default:
- wppa_log( 'Err', 'Invalid type: ' . htmlentities( $atts['type'] ) . ' in wppa shortcode ' . $wppa_current_shortcode );
+ wppa_log( 'Err', 'Invalid type: ' . $atts['type'] . ' in wppa shortcode ' . $wppa_current_shortcode );
return '';
}
--- a/wp-photo-album-plus/wppa-functions.php
+++ b/wp-photo-album-plus/wppa-functions.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Various functions
-* Version: 9.3.07.001
+* Version: 9.3.08.001
*
*/
@@ -3729,8 +3729,8 @@
wppa_out( '
<div
id="wppa-container-wrapper-' . wppa( 'mocc' ) . '"
- class="' . $class . ' ' . wppa( 'container-wrapper-class' ) . '"
- style="' . wppa_get_container_wrapper_style() . '"
+ class="' . esc_attr( $class . ' ' . wppa( 'container-wrapper-class' ) ) . '"
+ style="' . esc_attr( wppa_get_container_wrapper_style() ) . '"
>' );
break;
case 'close':
@@ -5213,12 +5213,10 @@
}
// Check for already exists
- if ( wppa_switch( 'void_dups' ) ) {
- if ( wppa_is_file_duplicate_photo( wppa_sanitize_file_name( $file['name'] ), $alb ) ) {
- /* translators: filename */
- $wppa_alert .= esc_js( sprintf( __( 'Uploaded file %s already exists in this album.', 'wp-photo-album-plus' ), wppa_sanitize_file_name( $file['name'] ) ) );
- return false;
- }
+ if ( wppa_is_file_duplicate_photo( wppa_sanitize_file_name( $file['name'] ), $alb ) ) {
+ /* translators: filename */
+ $wppa_alert .= esc_js( sprintf( __( 'Uploaded file %s already exists in this album.', 'wp-photo-album-plus' ), wppa_sanitize_file_name( $file['name'] ) ) );
+ return false;
}
// Find extension from mimetype
--- a/wp-photo-album-plus/wppa-import-ajax.php
+++ b/wp-photo-album-plus/wppa-import-ajax.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains the actual import functions
-* Version: 9.2.01.001
+* Version: 9.3.08.001
*
*/
@@ -491,7 +491,7 @@
if ( is_numeric( $alb ) && $alb != 0 ) {
// Is it a dup and no dups?
- if ( ( wppa_switch( 'void_dups' ) || wppa_get( 'nodups' ) ) && wppa_is_file_duplicate_photo( $name, $alb ) ) {
+ if ( wppa_is_file_duplicate_photo( $name, $alb ) ) {
$wppa_skip++;
wppa_log_skip( $name, 'duplicate not allowed' );
if ( wppa( 'is_remote' ) ) {
--- a/wp-photo-album-plus/wppa-import.php
+++ b/wp-photo-album-plus/wppa-import.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains all the import pages and functions
-* Version 9.3.00.002
+* Version 9.3.08.001
*
*/
@@ -521,12 +521,8 @@
wppa_import_header_check( 'cre-album', __( 'Import into album', 'wp-photo-album-plus' ) . ' ' . $src, ' value="' . esc_attr( $src ) . '"' );
}
wppa_import_header_check( 'wppa-update', __( 'Update existing photos', 'wp-photo-album-plus' ) );
- if ( wppa_switch( 'void_dups' ) ) {
- wppa_echo( '<input type="hidden" id="wppa-nodups" name="wppa-nodups" value="1" />' );
- }
- else {
- wppa_import_header_check( 'wppa-nodups', __( 'Do not create duplicates', 'wp-photo-album-plus' ) );
- }
+ wppa_echo( '<input type="hidden" id="wppa-nodups" name="wppa-nodups" value="1" />' );
+
if ( wppa_switch( 'import_preview' ) ) {
wppa_import_header_check( 'wppa-zoom', __( 'Zoom previews', 'wp-photo-album-plus' ) );
}
--- a/wp-photo-album-plus/wppa-index.php
+++ b/wp-photo-album-plus/wppa-index.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains all indexing functions
-* Version: 9.2.01.003
+* Version: 9.3.08.001
*
*
*/
@@ -58,7 +58,7 @@
// If this line does not exist yet, create it with only one album number as data
if ( ! $indexline ) {
wppa_create_index_entry( array( 'slug' => $word, 'albums' => $id ) );
- wppa_log( 'idx', 'Adding index slug {b}{span style="color:darkred"}' . $word . '{/span}{/b} for album {b}' . $id . '{/b}' );
+ wppa_log( 'idx', 'Adding index slug {b}' . $word . '{/b} for album {b}' . $id . '{/b}' );
$words_added .= $word . ' ';
}
@@ -127,7 +127,7 @@
// If this line does not exist yet, create it with only one album number as data
if ( ! $indexline ) {
wppa_create_index_entry( array( 'slug' => $word, 'photos' => $id ) );
- wppa_log( 'idx', 'Adding index slug {b}{span style="color:darkred"}' . $word . '{/span}{/b} for photo {b}' . $id . '{/b}' );
+ wppa_log( 'idx', 'Adding index slug {b}' . $word . '{/b} for photo {b}' . $id . '{/b}' );
$words_added .= $word . ' ';
}
--- a/wp-photo-album-plus/wppa-input.php
+++ b/wp-photo-album-plus/wppa-input.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains functions for sanitizing and formatting user input
-* Version: 9.3.07.001
+* Version: 9.3.08.001
*
*/
@@ -172,7 +172,6 @@
break;
// Html
- case 'comment':
case 'upn-description':
case 'user-desc': // Desc by user during fe upload
case 'albumeditdesc': // Fe album desc
@@ -215,6 +214,7 @@
case 'tab':
case 'edit-id':
case 'item':
+ case 'switchto':
$result = 'alpha';
break;
@@ -357,7 +357,7 @@
break;
case 'post':
- return isset( $_REQUEST[$key] ) ? wp_kses_post( ( str_replace( '%26', '&', wp_unslash( $_REQUEST[$key] ) ) ) ) : $default;
+ return isset( $_REQUEST[$key] ) ? wp_kses_post( wp_unslash( $_REQUEST[$key] ) ) : $default;
break;
case 'html':
@@ -434,7 +434,7 @@
case 'alpha':
$value = isset( $_REQUEST[$key] ) ? sanitize_text_field( wp_unslash( $_REQUEST[$key] ) ) : '';
- $value = str_replace( ["'", '"'], '', $value );
+ $value = wppa_alphadec( $value );
return $value;
break;
--- a/wp-photo-album-plus/wppa-mailing.php
+++ b/wp-photo-album-plus/wppa-mailing.php
@@ -4,7 +4,7 @@
*
* Contains mailing functions
*
-* Version 9.3.00.002
+* Version 9.3.08.001
*
*/
@@ -182,7 +182,7 @@
// Is this lock not older than 18 second?
if ( wppa_filetime( $lock_file ) >= ( time() - 18 ) ) {
- wppa_log( 'Eml', '{span style="color:red;" }{b}CRON ERROR{/b}{/span} Duplicate cron process detected. Aborting {b}' . $type . '{/b}' . $log_args );
+ wppa_log( 'Eml', '{span style="color:red;" }{b}CRON ERROR{/b} Duplicate cron process detected. Aborting {b}' . $type . '{/b}' . $log_args );
}
// It's older, so it is a regular re-run, but unneeded
--- a/wp-photo-album-plus/wppa-maintenance.php
+++ b/wp-photo-album-plus/wppa-maintenance.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains (not yet, but in the future maybe) all the maintenance routines
-* version 9.3.07.001
+* version 9.3.08.001
*
*/
@@ -546,7 +546,7 @@
case 'wppa_remake_index_photos':
$wa = wppa_index_add( 'photo', $id, 'force' );
if ( $wa ) {
- wppa_log( $logtype, 'Indexed photo {b}' . $id . '{/b} words added: {b}{span style="color:darkred"}' . $wa . '{/span}{/b}');
+ wppa_log( $logtype, 'Indexed photo {b}' . $id . '{/b} words added: {b}' . $wa . '{/b}');
}
break;
@@ -1095,17 +1095,17 @@
if ( strlen( $current_word ) < wppa_opt( 'search_min_length' ) ) {
wppa_del_row( $wpdb->wppa_index, 'slug', $current_word );
- wppa_log( 'idx', '{b}wppa_cleanup_index{/b} removed word {b}{span style="color:darkred"}' . $current_word . '{/b} from index because it is too short' );
+ wppa_log( 'idx', '{b}wppa_cleanup_index{/b} removed word {b}' . $current_word . '{/b} from index because it is too short' );
}
if ( ! $index['photos'] && ! $index['albums'] ) {
wppa_del_row( $wpdb->wppa_index, 'slug', $current_word );
- wppa_log( 'idx', '{b}wppa_cleanup_index{/b} removed word {b}{span style="color:darkred"}' . $current_word . '{/b} from index because it has no items' );
+ wppa_log( 'idx', '{b}wppa_cleanup_index{/b} removed word {b}' . $current_word . '{/b} from index because it has no items' );
}
else {
$albums = wppa_index_string_to_array( $indexes[$idx]['albums'] );
- wppa_log( 'idx', 'Start cleanup index # ' . $indexes[$idx]['id'] . ' word {b}{span style="color:darkred"}' . $indexes[$idx]['slug'] . '{/b}' );
+ wppa_log( 'idx', 'Start cleanup index # ' . $indexes[$idx]['id'] . ' word {b}' . $indexes[$idx]['slug'] . '{/b}' );
if ( is_array( $albums ) ) foreach( array_keys( $albums ) as $aidx ) {
@@ -1120,7 +1120,7 @@
// If album gone, remove it from index
if ( ! wppa_album_exists( $alb ) ) {
unset( $albums[$aidx] );
- wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $alb . ' from album index word {b}{span style="color:darkred"}' . $current_word . '{/span}{/b} because album vanished' );
+ wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $alb . ' from album index word {b}' . $current_word . '{/b} because album vanished' );
$didsome = true;
}
@@ -1129,7 +1129,7 @@
$words = wppa_index_raw_to_words( wppa_index_get_raw_album( $alb ) );
if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
unset( $albums[$aidx] );
- wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $alb . ' from album index word {b}{span style="color:darkred"}' . $current_word . '{/span}{/b} because word no longer in album' );
+ wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $alb . ' from album index word {b}' . $current_word . '{/b} because word no longer in album' );
$didsome = true;
}
wppa_cache_album( 'invalidate', $alb ); // Prevent cache overflow
@@ -1163,7 +1163,7 @@
// If photo gone, remove it from index
if ( ! wppa_photo_exists( $pho ) ) {
unset( $photos[$pidx] );
- wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $pho . ' from photo index word {b}{span style="color:darkred"}' . $current_word . '{/span}{/b} because photo vanished' );
+ wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $pho . ' from photo index word {b}' . $current_word . '{/b} because photo vanished' );
$didsome = true;
}
@@ -1172,7 +1172,7 @@
$words = wppa_index_raw_to_words( wppa_index_get_raw_photo( $pho ) );
if ( ! in_array( $indexes[$idx]['slug'], $words ) ) {
unset( $photos[$pidx] );
- wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $pho . ' from photo index word {b}{span style="color:darkred"}' . $current_word . '{/span}{/b} because word no longer in photo' );
+ wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Removed ' . $pho . ' from photo index word {b}' . $current_word . '{/b} because word no longer in photo' );
$didsome = true;
}
wppa_cache_photo( 'invalidate' ); // Prevent cache overflow
@@ -1200,7 +1200,7 @@
$photos = wppa_index_array_to_string( $photos );
if ( $didsome ) {
wppa_update_index( $indexes[$idx]['id'], ['albums' => $albums, 'photos' => $photos] );
- wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Updated index word {b}{span style="color:darkred"}' . $indexes[$idx]['slug'] . '{/span}{/b} with albums = ' . $albums . ' and photos = ' . $photos );
+ wppa_log( $logtype, '{b}wppa_cleanup_index{/b} Updated index word {b}' . $indexes[$idx]['slug'] . '{/b} with albums = ' . $albums . ' and photos = ' . $photos );
}
}
break;
--- a/wp-photo-album-plus/wppa-photo-admin-autosave.php
+++ b/wp-photo-album-plus/wppa-photo-admin-autosave.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* edit and delete photos
-* Version: 9.3.03.002
+* Version: 9.3.08.001
*
*/
@@ -3339,15 +3339,16 @@
if ( $newalb ) {
$photo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE id = %d", $id ), ARRAY_A );
wppa_echo( wppa_show_query( true ) );
- if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
- $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE filename = %s AND album = %d", $photo['filename'], $newalb ) );
- wppa_echo( wppa_show_query( true ) );
- if ( $exists ) { // Already exists
- /* translators: filename, albumname */
- wppa_error_message ( sprintf ( __( 'A photo with filename %1$s already exists in album %2$s.' , 'wp-photo-album-plus' ), $photo['filename'], $newalb ) );
- $skip = true;
- }
+
+ // Check for already exists
+ $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE filename = %s AND album = %d", $photo['filename'], $newalb ) );
+ wppa_echo( wppa_show_query( true ) );
+ if ( $exists ) { // Already exists
+ /* translators: filename, albumname */
+ wppa_error_message ( sprintf ( __( 'A photo with filename %1$s already exists in album %2$s.' , 'wp-photo-album-plus' ), $photo['filename'], $newalb ) );
+ $skip = true;
}
+
if ( ! $skip ) {
wppa_invalidate_treecounts( $photo['album'] ); // Current album
wppa_invalidate_treecounts( $newalb ); // New album
@@ -3361,14 +3362,15 @@
if ( $newalb ) {
$photo = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $wpdb->wppa_photos WHERE id = %d", $id ), ARRAY_A );
wppa_echo( wppa_show_query( true ) );
- if ( wppa_switch( 'void_dups' ) ) { // Check for already exists
- $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE filename = %s AND album = %d", $photo['filename'], $newalb ) );
- if ( $exists ) { // Already exists
- /* translators: filename, albumname */
- wppa_error_message ( sprintf ( __( 'A photo with filename %1$s already exists in album %2$s.' , 'wp-photo-album-plus' ), $photo['filename'], $newalb ) );
- $skip = true;
- }
+
+ // Check for already exists
+ $exists = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE filename = %s AND album = %d", $photo['filename'], $newalb ) );
+ if ( $exists ) { // Already exists
+ /* translators: filename, albumname */
+ wppa_error_message ( sprintf ( __( 'A photo with filename %1$s already exists in album %2$s.' , 'wp-photo-album-plus' ), $photo['filename'], $newalb ) );
+ $skip = true;
}
+
if ( ! $skip ) {
wppa_copy_photo( $id, $newalb );
wppa_invalidate_treecounts( $newalb );
--- a/wp-photo-album-plus/wppa-settings-autosave.php
+++ b/wp-photo-album-plus/wppa-settings-autosave.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* manage all options
-* version 9.3.06.001
+* version 9.3.08.001
*
*/
@@ -8250,7 +8250,7 @@
$desc = __('Prevent the creation of duplicate photos.', 'wp-photo-album-plus' );
$help = __('If checked: uploading, importing, copying or moving photos to other albums will be prevented when the destination album already contains a photo with the same filename.', 'wp-photo-album-plus' );
$slug = 'wppa_void_dups';
- $html = wppa_checkbox($slug);
+ $html = $security_no_disable;
wppa_setting_new($slug, 15, $name, $desc, $html, $help);
$name = __('Blacklist user', 'wp-photo-album-plus' );
--- a/wp-photo-album-plus/wppa-tinymce-shortcodes.php
+++ b/wp-photo-album-plus/wppa-tinymce-shortcodes.php
@@ -2,7 +2,7 @@
/* wppa-tinymce-shortcodes.php
* Pachkage: wp-photo-album-plus
*
-* Version 9.2.01.001
+* Version 9.3.08.001
*/
if ( ! defined( 'ABSPATH' ) ) exit();
@@ -339,7 +339,7 @@
<option value="#me">-- ' . __( 'The logged in visitor', 'wp-photo-album-plus' ) . ' --</option>';
$users = wppa_get_users();
if ( $users ) foreach ( $users as $user ) {
- $result .= '<option value="' . $user['user_login'] . '">' . $user['display_name'] . '</option>';
+ $result .= '<option value="' . esc_attr( $user['user_login'] ) . '">' . esc_html( $user['display_name'] ) . '</option>';
}
else { // Too many
$result .= '<option value="xxx">-- ' . __( 'Too many users, edit manually', 'wp-photo-album-plus' ) . ' --</option>';
--- a/wp-photo-album-plus/wppa-upload-common.php
+++ b/wp-photo-album-plus/wppa-upload-common.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains common upload functions
-* Version: 9.3.00.001
+* Version: 9.3.08.001
*
*/
@@ -112,16 +112,8 @@
// Check against duplicate files
if ( $new_type == 'image' || $new_type == 'document' ) {
if ( $ext_type == $new_type ) {
- if ( wppa_switch( 'void_dups' ) ) {
- /* translators: filename */
- wppa_upload_common_ok( sprintf( __( 'Item %s already exists in this album and will be overwritten', 'wp-photo-album-plus' ), $file['name'] ), $from );
- }
- else {
-
- // Forget its a dup
- $ext_type = '';
- $ext_id = false;
- }
+ /* translators: filename */
+ wppa_upload_common_ok( sprintf( __( 'Item %s already exists in this album and will be overwritten', 'wp-photo-album-plus' ), $file['name'] ), $from );
}
}
--- a/wp-photo-album-plus/wppa-utils.php
+++ b/wp-photo-album-plus/wppa-utils.php
@@ -3,7 +3,7 @@
* Package: wp-photo-album-plus
*
* Contains low-level utility routines
-* Version: 9.3.07.001
+* Version: 9.3.08.001
*
*/
@@ -1719,16 +1719,19 @@
// Debug mode on?
$dbg = wppa_switch( 'enable_debug' );
- if ( wppa_switch( 'enable_ext_logging' ) ) {
- $msg = '{b}'.$wppa_current_shortcode . '{/b} ' . $msg;
- }
-
// Sanitize message
$msg = wp_strip_all_tags( $msg );
$msg = wppa_nl2sp( $msg );
$msg = htmlspecialchars( $msg );
$msg = str_replace( 'style="color:darkred"', 'style="color:darkred"', $msg );
+ if ( wppa_switch( 'enable_ext_logging' ) ) {
+ $msg = '{b}' . wppa_alphadec( $wppa_current_shortcode, [], true ). '{/b} ' . wppa_alphadec( $msg, ['{','}','/'], true );
+ }
+ else {
+ $msg = wppa_alphadec( $msg, [], true );
+ }
+
// Test for recursive logging
if ( $busy ) {
wppa_update_option( 'wppa_recursive_log', $xtype . ' ' . $msg );
@@ -5253,8 +5256,8 @@
}
// Now do the other compressions
- $from = array( "> <", "<ul></ul>", "<!--", '" >', '&', 'style=" ', '"/>', ' style=""', 'px;', '/>' );
- $to = array( "><", "", "n<!--", '">', '&', 'style="', '" />', ' ', 'px;', '>' );
+ $from = array( "> <", "<ul></ul>", "<!--", '" >', 'style=" ', '"/>', ' style=""', 'px;', '/>' );
+ $to = array( "><", "", "n<!--", '">', 'style="', '" />', ' ', 'px;', '>' );
$result = str_replace( $from, $to, $result );
@@ -6590,4 +6593,48 @@
$may = in_array( $album, $albums );
return $may;
-}
No newline at end of file
+}
+
+// Sanitize string to contain only a--z A--Z 0--9 # $ , . - _
+function wppa_alphadec( $string, $extra = '', $indicate = false ) {
+static $allowed_dflt;
+static $allowed_extra;
+
+ if ( is_array( $string ) ) {
+ wppa_log('err', 'wppa_alpgadec() called with an array' );
+ return '';
+ }
+
+ if ( ! $allowed_dflt ) {
+ $allowed_dflt = ['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z',
+ 'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z',
+ '0','1','2','3','4','5','6','7','8','9'];
+ $allowed_extra = ['-','_','#','$',',','.',' '];
+ }
+
+ $check_against = $allowed_dflt;
+ if ( $extra != 'strict' ) {
+ $check_against = array_merge( $check_against, $allowed_extra );
+ }
+ if ( is_array( $extra ) ) {
+ $check_against = array_merge( $check_against, $extra );
+ }
+
+ $result = '';
+ $len = strlen( $string );
+ if ( $len ) {
+ $idx = 0;
+ while ( $idx < $len ) {
+ $char = substr( $string, $idx, 1 );
+ if ( in_array( $char, $check_against ) ) {
+ $result .= $char;
+ }
+ elseif ( $indicate ) {
+ $result .= '*';
+ }
+ $idx++;
+ }
+ }
+
+ return $result;
+}
--- a/wp-photo-album-plus/wppa.php
+++ b/wp-photo-album-plus/wppa.php
@@ -2,7 +2,7 @@
/*
* Plugin Name: WP Photo Album Plus
* Description: Easily manage and display your photo albums and slideshows within your WordPress site.
- * Version: 9.3.07.003
+ * Version: 9.3.08.001
* Author: J.N. Breetvelt a.k.a. OpaJaap
* Author URI: http://opajaap.nl/
* Plugin URI: https://wppa.nl/
@@ -22,7 +22,7 @@
global $wp_version;
/* WPPA Version */
-global $wppa_version; $wppa_version = '9.3.07.003'; // WPPA software version
+global $wppa_version; $wppa_version = '9.3.08.001'; // WPPA software version
global $wppa_revno; $wppa_revno = str_replace( '.', '', $wppa_version ); // WPPA db version
/* Init page js data */