Jelajahi Sumber

added some future function, and fixed some grammar issues, also removed some unnecesssary suffers

your username 5 tahun lalu
induk
melakukan
95830c1389

+ 7 - 1
SystemAOB/functions/timezone_v1/index.php

@@ -34,12 +34,18 @@
 				<select id="tz">
 				</select>
 			</div>
+			<!--
+			<div class="field">
+				<label>Change NTP Server</label>
+				<input type="text" placeholder="pool.ntp.org">
+			</div>
+			-->
 			<div class="field">
 				<button class="ts button" onclick="changetimezone()">Apply</button>
 			</div>
 		</div>
 		<p>
-		The system synchronizes to NTP server.
+		The system synchronizes to NTP server. Therefore you can't change the time.
 		</p>
 	</div>
 </div>

+ 1 - 0
SystemAOB/functions/timezone_v1/opr.php

@@ -44,6 +44,7 @@ if($_GET["opr"] == "query"){
 		exec('tzutil /s "'.$tz_win.'"');
 		echo "Finish";
 	}else{
+		//exec("sudo chmod -R 0777 /etc/systemd/timesyncd.conf");
 		exec("sudo timedatectl set-timezone '".$_GET["tz"]."'");
 		echo "Finish";
 	}

+ 0 - 35
SystemAOB/functions/timezone_v1/script/ip2iso_countrycode.php

@@ -1,35 +0,0 @@
-<?php
-include '../../../../auth.php';
-?>
-<?php
-$dbipcsv = "../data/dbip-country-2018-06.csv";
-$ip = $_GET["ip"];
-
-
-$data = "Not found";
-
-
-$csvData = file_get_contents($dbipcsv);
-$lines = explode(PHP_EOL, $csvData);
-$rangeArray = array();
-
-
-
-foreach ($lines as $line) {
-    //$rangeArray[] = str_getcsv($line);
-	$current = str_getcsv($line);
-	
-$array_start = explode(".", $current['0']);
-$array_stop = explode(".", $current['1']);
-
-if(ip2long($ip)>=ip2long($current[0])&&ip2long($ip)<=ip2long($current[1])){
-$data = $current[2];
-break;
-}
-	
-}
-
-header('Content-Type: application/json');
-echo '"'.$data.'"';
-
-?>

+ 0 - 32
SystemAOB/functions/timezone_v1/script/iso_countrycode2timezone.php

@@ -1,32 +0,0 @@
-<?php
-include '../../../../auth.php';
-?>
-<?php
-$dbipcsv = "../data/timezone.csv";
-$timezone = $_GET["timezone"];
-
-
-$data = [];
-
-
-$csvData = file_get_contents($dbipcsv);
-$lines = explode(PHP_EOL, $csvData);
-$rangeArray = array();
-
-
-
-foreach ($lines as $line) {
-    //$rangeArray[] = str_getcsv($line);
-	$current = str_getcsv($line);
-	
-
-if($timezone == $current['0']){
-array_push($data,$current[1]);
-}
-	
-}
-
-header('Content-Type: application/json');
-echo json_encode($data);
-
-?>

+ 0 - 7
SystemAOB/functions/timezone_v1/script/wait.php

@@ -1,7 +0,0 @@
-<?php
-include '../../../../auth.php';
-?>
-<?
-sleep($_GET["second"]);
-echo "end"
-?>

+ 5 - 4
SystemAOB/functions/timezone_v1/time.php

@@ -38,7 +38,7 @@ include '../../../auth.php';
       </div>
 <script>
 startup();
-var cur = new Date("1900-01-01 00:00:00");
+var cur = new Date("1900-01-01T00:00:00");
 var tz = "";
 
 function startup(){
@@ -58,14 +58,15 @@ function ShowTime(){
 function UpdateTime(){
 	
 	$.getJSON("opr.php?opr=query", function (data) {
-		cur = new Date(data["time"]);
+		cur = new Date(data["time"].replace(/-/g,"/"));
+		/* then it becomes YYYY-mm-ddTHH:mm:ss */
 		tz = data["f_timezone"];
 		
 		var timediff = (new Date() - cur);
 		if(timediff >= 0){
-			$("#timediff").text("This computer time was " + convert(timediff) + " ahead.");
+			$("#timediff").text("This computer was " + convert(timediff) + " ahead.");
 		}else{
-			$("#timediff").text("This computer time was lagging behind " + convert((-1*timediff)) + ".");
+			$("#timediff").text("This computer was lagging behind " + convert((-1*timediff)) + ".");
 		}
 	});
 }