<?php
$content_file = "amodules/remote/weather.inc.php";
$content_file_bk = "amodules/remote/weather.inc.php";
$have_wf = false;
if(file_exists($content_file)){
	if(time() - filemtime($content_file) > 3600 * 2) {
		$content_file = "https://www.cypruswebsites.com/amodules/remote/weather.inc.php";
		$have_wf = true;
	}
	else {
		$have_wf = true;
	}
}
else{
	$content_file = "../" . $content_file;
	$content_file_bk = $content_file;
	if(file_exists($content_file)){
		if(time() - filemtime($content_file) > 3600 * 2) {
			$content_file = "https://www.cypruswebsites.com/amodules/remote/weather.inc.php";
			$have_wf = true;
		}
		else {
            $content_file = "https://www.cypruswebsites.com/amodules/remote/weather.inc.php";
			$have_wf = true;
		}
	}
    else {
        $content_file = "https://www.cypruswebsites.com/amodules/remote/weather.inc.php";
        $have_wf = true;
    }
	
	//file_get_contents();
}

if($have_wf) {
	$stream_opts = [
		"ssl" => [
			"verify_peer"=>false,
			"verify_peer_name"=>false,
		]
	];
	$wf = file_get_contents($content_file, false, stream_context_create($stream_opts));
	if(strpos($content_file, 'http') !== false) {
		$ret = file_put_contents($content_file_bk, $wf, LOCK_EX);
		touch($content_file_bk);
	}
	
	
	$wf = str_replace("/images/icons", $path . "images/icons", $wf);
	echo $wf;
}
///images/icons
?>