HEX
Server: LiteSpeed
System: Linux d8 4.18.0-553.121.1.lve.el8.x86_64 #1 SMP Thu Apr 30 16:40:41 UTC 2026 x86_64
User: wbwebdes (3015)
PHP: 8.1.31
Disabled: exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
Upload Files
File: /home/wbwebdes/domains/files.wb-cloud.nl/public_html/3rdparty/icewind/smb/src/TimeZoneProvider.php
<?php
/**
 * SPDX-FileCopyrightText: 2015 Robin Appelman <[email protected]>
 * SPDX-License-Identifier: MIT
 */
namespace Icewind\SMB;

class TimeZoneProvider implements ITimeZoneProvider {
	/**
	 * @var string[]
	 */
	private $timeZones = [];

	/**
	 * @var ISystem
	 */
	private $system;

	/**
	 * @param ISystem $system
	 */
	public function __construct(ISystem $system) {
		$this->system = $system;
	}

	public function get(string $host): string {
		if (!isset($this->timeZones[$host])) {
			$timeZone = null;
			$net = $this->system->getNetPath();
			// for local domain names we can assume same timezone
			if ($net && $host && strpos($host, '.') !== false) {
				$command = sprintf(
					'%s time zone -S %s',
					$net,
					escapeshellarg($host)
				);
				$timeZone = exec($command);
			}

			if (!$timeZone) {
				$date = $this->system->getDatePath();
				if ($date) {
					$timeZone = exec($date . " +%z");
				} else {
					$timeZone = date_default_timezone_get();
				}
			}
			$this->timeZones[$host] = $timeZone;
		}
		return $this->timeZones[$host];
	}
}