__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

root@216.73.217.120: ~ $
<?php
/**
 * Shared validation for the gallery storage path (relative to the galleries document root).
 *
 * @package Imagely\NGG\Settings
 */

namespace Imagely\NGG\Settings;

use Imagely\NGG\Util\Filesystem;
use WP_Error;

/**
 * Validates user-provided gallerypath strings for saves and REST updates.
 */
class GalleryPathValidation {

	/**
	 * @param mixed $gallerypath Raw value (typically string from form or JSON).
	 * @return true|\WP_Error True if the path is a safe relative path under the galleries root.
	 */
	public static function validate_relative_under_galleries_root( $gallerypath ) {
		if ( ! is_string( $gallerypath ) ) {
			return new WP_Error(
				'invalid_gallerypath',
				__( 'Gallery path must be a string.', 'nggallery' )
			);
		}
		$trimmed = trim( $gallerypath );
		if ( '' === $trimmed ) {
			return new WP_Error(
				'invalid_gallerypath',
				__( 'Gallery path must be a non-empty relative path.', 'nggallery' )
			);
		}

		$fs       = Filesystem::get_instance();
		$root     = wp_normalize_path( $fs->get_document_root( 'galleries' ) );
		$relative = $fs->add_trailing_slash( $trimmed );
		$sections = explode( '/', str_replace( '\\', '/', trim( $relative, '/\\' ) ) );
		if ( in_array( '..', $sections, true ) ) {
			return new WP_Error(
				'invalid_gallerypath',
				__( "Gallery paths may not use '..' to access parent directories.", 'nggallery' )
			);
		}

		$gallery_abspath = wp_normalize_path( path_join( $root, $relative ) );
		$root_normalized = wp_normalize_path( $root );
		$root_prefixed   = trailingslashit( $root_normalized );
		// PHP 7.4: avoid str_starts_with() (PHP 8+).
		$under_root      = ( $gallery_abspath === $root_normalized )
			|| (
				strlen( $gallery_abspath ) >= strlen( $root_prefixed )
				&& 0 === strpos( $gallery_abspath, $root_prefixed )
			);
		if ( ! $under_root ) {
			return new WP_Error(
				'invalid_gallerypath',
				sprintf(
					/* translators: %s: galleries root directory path */
					__( 'Gallery path must be located under %s', 'nggallery' ),
					$root_normalized
				)
			);
		}

		return true;
	}
}

Filemanager

Name Type Size Permission Actions
GalleryPathValidation.php File 2.04 KB 0644
GlobalSettings.php File 1.21 KB 0644
Installer.php File 10.42 KB 0644
ManagerBase.php File 7.46 KB 0644
Settings.php File 2.07 KB 0644
Filemanager