GRAYBYTE WORDPRESS FILE MANAGER1515

Server IP : 198.54.121.189 / Your IP : 216.73.216.140
System : Linux premium69.web-hosting.com 4.18.0-553.44.1.lve.el8.x86_64 #1 SMP Thu Mar 13 14:29:12 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Directory : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/backwpup/inc/
Upload Files :
Current_dir [ Writeable ] Document_root [ Writeable ]

Command :


Current File : /home/giriqfky/trustyourlawyer.com/wp-content/plugins/backwpup/inc//class-file.php
<?php
/**
 * Class for methods for file/folder related things.
 *
 * @todo Please split this logic into two separated classes. One for File and another for dir.
 */
class BackWPup_File
{
    /**
     * Get the folder for blog uploads.
     *
     * @return string
     */
    public static function get_upload_dir()
    {
        if (is_multisite()) {
            if (defined('UPLOADBLOGSDIR')) {
                return trailingslashit(str_replace('\\', '/', ABSPATH . UPLOADBLOGSDIR));
            }
            if (is_dir(trailingslashit(WP_CONTENT_DIR) . 'uploads/sites')) {
                return str_replace('\\', '/', trailingslashit(WP_CONTENT_DIR) . 'uploads/sites/');
            }
            if (is_dir(trailingslashit(WP_CONTENT_DIR) . 'uploads')) {
                return str_replace('\\', '/', trailingslashit(WP_CONTENT_DIR) . 'uploads/');
            }

            return trailingslashit(str_replace('\\', '/', (string) WP_CONTENT_DIR));
        }
        $upload_dir = wp_upload_dir(null, false, true);

        return trailingslashit(str_replace('\\', '/', $upload_dir['basedir']));
    }

    /**
     * check if path in open basedir.
     *
     * @param string $file the file path to check
     *
     * @return bool is it in open basedir
     */
    public static function is_in_open_basedir($file)
    {
        $ini_open_basedir = ini_get('open_basedir');

        if (empty($ini_open_basedir)) {
            return true;
        }

        $open_base_dirs = explode(PATH_SEPARATOR, $ini_open_basedir);
        $file = trailingslashit(strtolower(BackWPup_Path_Fixer::slashify($file)));

        foreach ($open_base_dirs as $open_base_dir) {
            if (empty($open_base_dir) || !realpath($open_base_dir)) {
                continue;
            }

            $open_base_dir = realpath($open_base_dir);
            $open_base_dir = strtolower(BackWPup_Path_Fixer::slashify($open_base_dir));
            $part = substr($file, 0, strlen($open_base_dir));
            if ($part === $open_base_dir) {
                return true;
            }
        }

        return false;
    }

	/**
	 * Get size of files in folder if enabled
	 *
	 * @param string $folder the folder to calculate.
	 *
	 * @return string folder size formated in human readable format
	 */
	public static function get_folder_size( $folder ) {

		/**
		 * Filter whether BackWPup will show the folder size.
		 *
		 * @param bool $show_folder_size whether BackWPup will show the folder size or not.
		 */
		$show_folder_size = wpm_apply_filters_typed( 'boolean', 'backwpup_show_folder_size', (bool) get_site_option( 'backwpup_cfg_showfoldersize' ) );

		if ( ! $show_folder_size ) {
			return '';
		}

		$files_size = 0;

		if ( ! is_readable( $folder ) ) {
			return self::format_size( $files_size );
		}

        $iterator = new RecursiveIteratorIterator(new BackWPup_Recursive_Directory($folder, FilesystemIterator::SKIP_DOTS));

        foreach ($iterator as $file) {
            if (!$file->isLink()) {
                $files_size += $file->getSize();
            }
        }

		return self::format_size( $files_size );
	}

	/**
	 * Format size in human readable format.
	 *
	 * @param int $size
	 *
	 * @return string
	 */
	protected static function format_size( $size ): string {
		return ' (' . size_format( $size, 2 ) . ')';
	}

    /**
     * Get an absolute path if it is relative.
     *
     * @param string $path
     *
     * @return string
     */
    public static function get_absolute_path($path = '/')
    {
        $path = BackWPup_Path_Fixer::slashify($path);
        $content_path = trailingslashit(BackWPup_Path_Fixer::slashify((string) WP_CONTENT_DIR));

        //use WP_CONTENT_DIR as root folder
        if (empty($path) || $path === '/') {
            $path = $content_path;
        }

        //make relative path to absolute
        if (substr($path, 0, 1) !== '/' && !preg_match('#^[a-zA-Z]+:/#', $path)) {
            $path = $content_path . $path;
        }

        return self::resolve_path($path);
    }

    /**
     * Check is folder readable and exists create it if not
     * add .htaccess or index.html file in folder to prevent directory listing.
     *
     * @param string $folder      the folder to check
     * @param bool   $donotbackup Create a file that the folder will not backuped
     *
     * @return string with error message if one
     */
    public static function check_folder(string $folder, bool $donotbackup = false): string
    {
        $folder = self::get_absolute_path($folder);
        $folder = untrailingslashit($folder);

        //check that is not home of WP
        $uploads = self::get_upload_dir();
        if ($folder === untrailingslashit(BackWPup_Path_Fixer::slashify(ABSPATH))
            || $folder === untrailingslashit(BackWPup_Path_Fixer::slashify(dirname(ABSPATH)))
            || $folder === untrailingslashit(BackWPup_Path_Fixer::slashify(WP_PLUGIN_DIR))
            || $folder === untrailingslashit(BackWPup_Path_Fixer::slashify(WP_CONTENT_DIR))
            || $folder === untrailingslashit(BackWPup_Path_Fixer::slashify($uploads))
        ) {
            return sprintf(__('Folder %1$s not allowed, please use another folder.', 'backwpup'), $folder);
        }

        //open base dir check
        if (!self::is_in_open_basedir($folder)) {
            return sprintf(__('Folder %1$s is not in open basedir, please use another folder.', 'backwpup'), $folder);
        }

        // We always want to at least process `$folder`
        $foldersToProcess = [$folder];
        $parentFolder = dirname($folder);

        while (!file_exists($parentFolder)) {
            array_unshift($foldersToProcess, $parentFolder);
            $parentFolder = dirname($parentFolder);
        }

        // Process each child folder separately
        foreach ($foldersToProcess as $childFolder) {
            if (!is_dir($childFolder) && !wp_mkdir_p($childFolder)) {
                return sprintf(__('Cannot create folder: %1$s', 'backwpup'), $childFolder);
            }

            if (!is_writable($childFolder)) {
                return sprintf(__('Folder "%1$s" is not writable', 'backwpup'), $childFolder);
            }

			// create files for securing folder.
			/**
			 * Filter whether BackWPup will protect the folders.
			 *
			 * @param bool $protect_folders Whether the folder will be protect or not.
			 */
			$protect_folders = wpm_apply_filters_typed( 'boolean', 'backwpup_protect_folders', (bool) get_site_option( 'backwpup_cfg_protectfolders' ) );
			if ( $protect_folders ) {
				self::protect_folder( $childFolder ); // phpcs:ignore
			}

            //Create do not backup file for this folder
            if ($donotbackup) {
                self::write_do_not_backup_file($childFolder);
            }
        }

        return '';
    }

    /**
     * @throws InvalidArgumentException If path is absolute or attempts to navigate above root
     */
    public static function normalize_path(string $path): string
    {
        if (strpos($path, '/') === 0) {
            throw new InvalidArgumentException('Absolute paths are not allowed.');
        }

        $parts = explode('/', $path);
        $normalized = [];

        foreach ($parts as $part) {
            if ($part === '..') {
                if (empty($normalized)) {
                    throw new InvalidArgumentException(
                        'Invalid path: Attempting to navigate above the root directory.'
                    );
                }
                array_pop($normalized);
            } elseif ($part !== '.' && $part !== '') {
                $normalized[] = $part;
            }
        }

        if (empty($normalized)) {
            throw new InvalidArgumentException('The path resolves to an empty path.');
        }

        return implode('/', $normalized);
    }

    /**
     * Resolve internal .. within a path.
     *
     * @param string $path The path to resolve
     *
     * @return string The resolved path
     */
    protected static function resolve_path($path): string
    {
        $parts = explode('/', $path);
        $resolvedParts = [];

        foreach ($parts as $part) {
            if ($part === '..') {
                if (!empty($resolvedParts)) {
                    array_pop($resolvedParts);
                }
            } elseif ($part === '.') {
                continue;
            } else {
                $resolvedParts[] = $part;
            }
        }

        return implode('/', $resolvedParts);
    }

    private static function protect_folder(string $folder): void
    {
        $server_software = strtolower((string) $_SERVER['SERVER_SOFTWARE']);

        if (strstr($server_software, 'microsoft-iis')) {
            if (!file_exists($folder . '/Web.config')) {
                file_put_contents(
                    $folder . '/Web.config',
                    '<configuration>' . PHP_EOL .
                    "\t<system.webServer>" . PHP_EOL .
                    "\t\t<authorization>" . PHP_EOL .
                    "\t\t\t<deny users=\"*\" />" . PHP_EOL .
                    "\t\t</authorization>" . PHP_EOL .
                    "\t</system.webServer>" . PHP_EOL .
                    '</configuration>'
                );
            }
        } elseif (strstr($server_software, 'nginx')) {
            if (!file_exists($folder . '/index.php')) {
                file_put_contents(
                    $folder . '/index.php',
                    '<?php' . PHP_EOL . "header( \$_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found' );" . PHP_EOL . "header( 'Status: 404 Not Found' );" . PHP_EOL
                );
            }
        } else {
            if (!file_exists($folder . '/.htaccess')) {
                file_put_contents(
                    $folder . '/.htaccess',
                    '<Files "*">' . PHP_EOL . '<IfModule mod_access.c>' . PHP_EOL . 'Deny from all' . PHP_EOL . '</IfModule>' . PHP_EOL . '<IfModule !mod_access_compat>' . PHP_EOL . '<IfModule mod_authz_host.c>' . PHP_EOL . 'Deny from all' . PHP_EOL . '</IfModule>' . PHP_EOL . '</IfModule>' . PHP_EOL . '<IfModule mod_access_compat>' . PHP_EOL . 'Deny from all' . PHP_EOL . '</IfModule>' . PHP_EOL . '</Files>'
                );
            }
            if (!file_exists($folder . '/index.php')) {
                file_put_contents(
                    $folder . '/index.php',
                    '<?php' . PHP_EOL . "header( \$_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found' );" . PHP_EOL . "header( 'Status: 404 Not Found' );" . PHP_EOL
                );
            }
        }
    }

    private static function write_do_not_backup_file(string $folder): void
    {
        $doNotBackupFile = "{$folder}/.donotbackup";

        if (!file_exists($doNotBackupFile)) {
            file_put_contents(
                $doNotBackupFile,
                __(
                    'BackWPup will not backup folders and its sub folders when this file is inside.',
                    'backwpup'
                )
            );
        }
    }
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
July 10 2025 04:32:29
giriqfky / giriqfky
0755
Notice
--
July 10 2025 04:32:37
giriqfky / giriqfky
0755
Settings
--
July 10 2025 04:32:37
giriqfky / giriqfky
0755
ThirdParty
--
July 10 2025 04:32:37
giriqfky / giriqfky
0755
Utils
--
July 10 2025 04:32:37
giriqfky / giriqfky
0755
dependencies
--
July 10 2025 04:32:37
giriqfky / giriqfky
0755
.htaccess
0.41 KB
July 10 2025 04:32:37
giriqfky / giriqfky
0644
BackWPup.php
11.618 KB
May 20 2025 11:41:24
giriqfky / giriqfky
0644
class-admin.php
44.521 KB
May 20 2025 11:41:24
giriqfky / giriqfky
0644
class-adminbar.php
2.676 KB
May 20 2025 11:41:24
giriqfky / giriqfky
0644
class-create-archive-exception.php
0.148 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-create-archive.php
27.247 KB
March 10 2025 14:47:06
giriqfky / giriqfky
0644
class-cron.php
18.585 KB
April 29 2025 17:34:12
giriqfky / giriqfky
0644
class-destination-connect-exception.php
0.218 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-connect-interface.php
0.647 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-download-exception.php
0.202 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-downloader-data.php
1.223 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-downloader-factory.php
1.629 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-downloader-interface.php
0.52 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-downloader.php
5.126 KB
June 04 2024 10:51:14
giriqfky / giriqfky
0644
class-destination-dropbox-api-exception.php
0.129 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-dropbox-api-request-exception.php
0.595 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-dropbox-api.php
40.892 KB
February 13 2025 20:02:44
giriqfky / giriqfky
0644
class-destination-dropbox-downloader.php
2.907 KB
October 18 2023 17:06:40
giriqfky / giriqfky
0644
class-destination-dropbox.php
21.399 KB
May 20 2025 11:41:24
giriqfky / giriqfky
0644
class-destination-email.php
19.876 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-destination-folder-downloader.php
3.488 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-folder.php
10.113 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-destination-ftp-connect.php
5.373 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-ftp-downloader.php
3.351 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-ftp.php
29.519 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-destination-msazure-downloader.php
3.369 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-msazure.php
26.319 KB
February 04 2025 14:50:44
giriqfky / giriqfky
0644
class-destination-rsc.php
22.318 KB
March 21 2025 15:27:30
giriqfky / giriqfky
0644
class-destination-s3-downloader.php
3.298 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-destination-s3.php
48.635 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-destination-sugarsync.php
38.054 KB
February 04 2025 14:50:44
giriqfky / giriqfky
0644
class-destinations.php
6.154 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-directory.php
6.025 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-download-file-interface.php
0.609 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-download-file.php
3.406 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-download-handler.php
1.956 KB
October 18 2023 17:06:40
giriqfky / giriqfky
0644
class-easycron.php
8.057 KB
October 01 2024 16:10:48
giriqfky / giriqfky
0644
class-encryption-fallback.php
2.875 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-encryption-mcrypt.php
4.014 KB
March 03 2025 19:19:24
giriqfky / giriqfky
0644
class-encryption-openssl.php
3.925 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-encryption.php
6.265 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-factory-exception.php
0.191 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-file.php
10.787 KB
March 13 2025 16:05:40
giriqfky / giriqfky
0644
class-help.php
1.745 KB
October 18 2023 17:06:40
giriqfky / giriqfky
0644
class-install.php
18.464 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-job.php
105.758 KB
May 20 2025 11:41:24
giriqfky / giriqfky
0644
class-jobtype-dbcheck.php
6.386 KB
October 18 2023 17:06:40
giriqfky / giriqfky
0644
class-jobtype-dbdump.php
11.304 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-jobtype-file.php
24.155 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-jobtype-wpexp.php
34.94 KB
March 13 2025 16:05:40
giriqfky / giriqfky
0644
class-jobtype-wpplugin.php
6.864 KB
March 03 2025 19:19:24
giriqfky / giriqfky
0644
class-jobtypes.php
2.25 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-message-box.php
3.464 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-migrate.php
10.691 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-msazure-destination-configuration.php
1.597 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-mysqldump.php
34.067 KB
June 19 2024 12:40:40
giriqfky / giriqfky
0644
class-option.php
18.498 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-page-about.php
27.481 KB
June 19 2024 12:40:40
giriqfky / giriqfky
0644
class-page-backups.php
20.81 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-page-backwpup.php
21.946 KB
October 18 2023 17:06:40
giriqfky / giriqfky
0644
class-page-editjob.php
47.442 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-page-firstbackup.php
0.556 KB
February 04 2025 14:50:44
giriqfky / giriqfky
0644
class-page-jobs.php
44.727 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-page-logs.php
13.824 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
class-page-onboarding.php
6.948 KB
May 20 2025 11:41:24
giriqfky / giriqfky
0644
class-page-restore.php
5.368 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-page-settings.php
45.41 KB
April 07 2025 18:31:08
giriqfky / giriqfky
0644
class-path-fixer.php
0.815 KB
October 18 2023 17:06:40
giriqfky / giriqfky
0644
class-recursive-directory.php
0.573 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-s3-destination.php
11.986 KB
March 13 2025 16:05:40
giriqfky / giriqfky
0644
class-sanitize-path.php
1.547 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-system-requirements.php
1.231 KB
October 01 2024 16:10:48
giriqfky / giriqfky
0644
class-system-tests-runner.php
9.5 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-system-tests.php
3.469 KB
November 16 2022 17:55:50
giriqfky / giriqfky
0644
class-thirdparties.php
1.023 KB
June 19 2024 12:40:40
giriqfky / giriqfky
0644
class-wp-api.php
43.999 KB
April 29 2025 17:34:12
giriqfky / giriqfky
0644
class-wp-cli.php
11.83 KB
April 23 2025 14:14:02
giriqfky / giriqfky
0644
functions.php
5.883 KB
April 30 2025 17:12:56
giriqfky / giriqfky
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF