GRAYBYTE WORDPRESS FILE MANAGER7701

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 : /usr/src/litespeed-wp-plugin/6.5.2/litespeed-cache/src/
Upload Files :
Current_dir [ Not Writeable ] Document_root [ Writeable ]

Command :


Current File : /usr/src/litespeed-wp-plugin/6.5.2/litespeed-cache/src//import.cls.php
<?php

/**
 * The import/export class.
 *
 * @since      	1.8.2
 */

namespace LiteSpeed;

defined('WPINC') || exit();

class Import extends Base
{
	protected $_summary;

	const TYPE_IMPORT = 'import';
	const TYPE_EXPORT = 'export';
	const TYPE_RESET = 'reset';

	/**
	 * Init
	 *
	 * @since  1.8.2
	 */
	public function __construct()
	{
		Debug2::debug('Import init');

		$this->_summary = self::get_summary();
	}

	/**
	 * Export settings to file
	 *
	 * @since  1.8.2
	 * @access public
	 */
	public function export($only_data_return = false)
	{
		$raw_data = $this->get_options(true);

		$data = array();
		foreach ($raw_data as $k => $v) {
			$data[] = \json_encode(array($k, $v));
		}

		$data = implode("\n\n", $data);

		if ($only_data_return) {
			return $data;
		}

		$filename = $this->_generate_filename();

		// Update log
		$this->_summary['export_file'] = $filename;
		$this->_summary['export_time'] = time();
		self::save_summary();

		Debug2::debug('Import: Saved to ' . $filename);

		@header('Content-Disposition: attachment; filename=' . $filename);
		echo $data;

		exit();
	}

	/**
	 * Import settings from file
	 *
	 * @since  1.8.2
	 * @access public
	 */
	public function import($file = false)
	{
		if (!$file) {
			if (empty($_FILES['ls_file']['name']) || substr($_FILES['ls_file']['name'], -5) != '.data' || empty($_FILES['ls_file']['tmp_name'])) {
				Debug2::debug('Import: Failed to import, wrong ls_file');

				$msg = __('Import failed due to file error.', 'litespeed-cache');
				Admin_Display::error($msg);

				return false;
			}

			$this->_summary['import_file'] = $_FILES['ls_file']['name'];

			$data = file_get_contents($_FILES['ls_file']['tmp_name']);
		} else {
			$this->_summary['import_file'] = $file;

			$data = file_get_contents($file);
		}

		// Update log
		$this->_summary['import_time'] = time();
		self::save_summary();

		$ori_data = array();
		try {
			// Check if the data is v4+ or not
			if (strpos($data, '["_version",') === 0) {
				Debug2::debug('[Import] Data version: v4+');
				$data = explode("\n", $data);
				foreach ($data as $v) {
					$v = trim($v);
					if (!$v) {
						continue;
					}
					list($k, $v) = \json_decode($v, true);
					$ori_data[$k] = $v;
				}
			} else {
				$ori_data = \json_decode(base64_decode($data), true);
			}
		} catch (\Exception $ex) {
			Debug2::debug('[Import] ❌ Failed to parse serialized data');
			return false;
		}

		if (!$ori_data) {
			Debug2::debug('[Import] ❌ Failed to import, no data');
			return false;
		} else {
			Debug2::debug('[Import] Importing data', $ori_data);
		}

		$this->cls('Conf')->update_confs($ori_data);

		if (!$file) {
			Debug2::debug('Import: Imported ' . $_FILES['ls_file']['name']);

			$msg = sprintf(__('Imported setting file %s successfully.', 'litespeed-cache'), $_FILES['ls_file']['name']);
			Admin_Display::succeed($msg);
		} else {
			Debug2::debug('Import: Imported ' . $file);
		}

		return true;
	}

	/**
	 * Reset all configs to default values.
	 *
	 * @since  2.6.3
	 * @access public
	 */
	public function reset()
	{
		$options = $this->cls('Conf')->load_default_vals();

		$this->cls('Conf')->update_confs($options);

		Debug2::debug('[Import] Reset successfully.');

		$msg = __('Reset successfully.', 'litespeed-cache');
		Admin_Display::succeed($msg);
	}

	/**
	 * Generate the filename to export
	 *
	 * @since  1.8.2
	 * @access private
	 */
	private function _generate_filename()
	{
		// Generate filename
		$parsed_home = parse_url(get_home_url());
		$filename = 'LSCWP_cfg-';
		if (!empty($parsed_home['host'])) {
			$filename .= $parsed_home['host'] . '_';
		}

		if (!empty($parsed_home['path'])) {
			$filename .= $parsed_home['path'] . '_';
		}

		$filename = str_replace('/', '_', $filename);

		$filename .= '-' . date('Ymd_His') . '.data';

		return $filename;
	}

	/**
	 * Handle all request actions from main cls
	 *
	 * @since  1.8.2
	 * @access public
	 */
	public function handler()
	{
		$type = Router::verify_type();

		switch ($type) {
			case self::TYPE_IMPORT:
				$this->import();
				break;

			case self::TYPE_EXPORT:
				$this->export();
				break;

			case self::TYPE_RESET:
				$this->reset();
				break;

			default:
				break;
		}

		Admin::redirect();
	}
}

[ Back ]
Name
Size
Last Modified
Owner / Group
Permissions
Options
..
--
January 01 1970 00:00:00
root / root
0
cdn
--
October 17 2024 21:42:34
root / root
0755
data_structure
--
October 17 2024 21:42:34
root / root
0755
activation.cls.php
14.991 KB
October 17 2024 21:42:34
root / root
0644
admin-display.cls.php
33.202 KB
October 17 2024 21:42:34
root / root
0644
admin-settings.cls.php
9.521 KB
October 17 2024 21:42:34
root / root
0644
admin.cls.php
4.441 KB
October 17 2024 21:42:34
root / root
0644
api.cls.php
11.076 KB
October 17 2024 21:42:34
root / root
0644
avatar.cls.php
6.063 KB
October 17 2024 21:42:34
root / root
0644
base.cls.php
30.233 KB
October 17 2024 21:42:34
root / root
0644
cdn-setup.cls.php
10.451 KB
October 17 2024 21:42:34
root / root
0644
cdn.cls.php
13.132 KB
October 17 2024 21:42:34
root / root
0644
cloud.cls.php
42.476 KB
October 17 2024 21:42:34
root / root
0644
conf.cls.php
18.579 KB
October 17 2024 21:42:34
root / root
0644
control.cls.php
21.746 KB
October 17 2024 21:42:34
root / root
0644
core.cls.php
20.05 KB
October 17 2024 21:42:34
root / root
0644
crawler-map.cls.php
13.999 KB
October 17 2024 21:42:34
root / root
0644
crawler.cls.php
34.689 KB
October 17 2024 21:42:34
root / root
0644
css.cls.php
13.104 KB
October 17 2024 21:42:34
root / root
0644
data.cls.php
17.406 KB
October 17 2024 21:42:34
root / root
0644
data.upgrade.func.php
21.372 KB
October 17 2024 21:42:34
root / root
0644
db-optm.cls.php
9.585 KB
October 17 2024 21:42:34
root / root
0644
debug2.cls.php
13.098 KB
October 17 2024 21:42:34
root / root
0644
doc.cls.php
4.737 KB
October 17 2024 21:42:34
root / root
0644
error.cls.php
6.905 KB
October 17 2024 21:42:34
root / root
0644
esi.cls.php
26.907 KB
October 17 2024 21:42:34
root / root
0644
file.cls.php
10.135 KB
October 17 2024 21:42:34
root / root
0644
gui.cls.php
27.449 KB
October 17 2024 21:42:34
root / root
0644
health.cls.php
2.893 KB
October 17 2024 21:42:34
root / root
0644
htaccess.cls.php
23.952 KB
October 17 2024 21:42:34
root / root
0644
img-optm.cls.php
60.243 KB
October 17 2024 21:42:34
root / root
0644
import.cls.php
4.15 KB
October 17 2024 21:42:34
root / root
0644
instance.cls.php
0.15 KB
October 17 2024 21:42:34
root / root
0644
lang.cls.php
15.473 KB
October 17 2024 21:42:34
root / root
0644
localization.cls.php
3.383 KB
October 17 2024 21:42:34
root / root
0644
media.cls.php
31.025 KB
October 17 2024 21:42:34
root / root
0644
metabox.cls.php
4.205 KB
October 17 2024 21:42:34
root / root
0644
object-cache.cls.php
15.917 KB
October 17 2024 21:42:34
root / root
0644
object.lib.php
33.969 KB
October 17 2024 21:42:34
root / root
0644
optimize.cls.php
36.525 KB
October 17 2024 21:42:34
root / root
0644
optimizer.cls.php
9.016 KB
October 17 2024 21:42:34
root / root
0644
placeholder.cls.php
14.115 KB
October 17 2024 21:42:34
root / root
0644
preset.cls.php
5.43 KB
October 17 2024 21:42:34
root / root
0644
purge.cls.php
29.785 KB
October 17 2024 21:42:34
root / root
0644
report.cls.php
5.328 KB
October 17 2024 21:42:34
root / root
0644
rest.cls.php
7.871 KB
October 17 2024 21:42:34
root / root
0644
root.cls.php
12.596 KB
October 17 2024 21:42:34
root / root
0644
router.cls.php
19.078 KB
October 17 2024 21:42:34
root / root
0644
str.cls.php
1.175 KB
October 17 2024 21:42:34
root / root
0644
tag.cls.php
8.619 KB
October 17 2024 21:42:34
root / root
0644
task.cls.php
5.825 KB
October 17 2024 21:42:34
root / root
0644
tool.cls.php
3.291 KB
October 17 2024 21:42:34
root / root
0644
ucss.cls.php
14.39 KB
October 17 2024 21:42:34
root / root
0644
utility.cls.php
20.634 KB
October 17 2024 21:42:34
root / root
0644
vary.cls.php
19.171 KB
October 17 2024 21:42:34
root / root
0644
vpi.cls.php
7.408 KB
October 17 2024 21:42:34
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2025
CONTACT ME
Static GIF