Browse Source

Commit, updated tz and wifi

your username 5 years ago
parent
commit
8eab562a81
37 changed files with 2186 additions and 0 deletions
  1. 7 0
      System Settings/menus/network.csv
  2. 2 0
      System Settings/menus/time.csv
  3. 22 0
      SystemAOB/functions/timezone_v1/convert.php
  4. 234 0
      SystemAOB/functions/timezone_v1/data/timezone.csv
  5. BIN
      SystemAOB/functions/timezone_v1/getTime.exe
  6. 99 0
      SystemAOB/functions/timezone_v1/index.php
  7. 51 0
      SystemAOB/functions/timezone_v1/opr.php
  8. 35 0
      SystemAOB/functions/timezone_v1/script/ip2iso_countrycode.php
  9. 32 0
      SystemAOB/functions/timezone_v1/script/iso_countrycode2timezone.php
  10. 7 0
      SystemAOB/functions/timezone_v1/script/wait.php
  11. 104 0
      SystemAOB/functions/timezone_v1/time.php
  12. 6 0
      SystemAOB/functions/wifi_v1/NICinfo.txt
  13. 91 0
      SystemAOB/functions/wifi_v1/accesspoint.php
  14. 97 0
      SystemAOB/functions/wifi_v1/addnew.php
  15. 180 0
      SystemAOB/functions/wifi_v1/availablenetwork.php
  16. BIN
      SystemAOB/functions/wifi_v1/fonts/Ethernet.png
  17. BIN
      SystemAOB/functions/wifi_v1/fonts/Unknwon.png
  18. BIN
      SystemAOB/functions/wifi_v1/fonts/WiFi.png
  19. BIN
      SystemAOB/functions/wifi_v1/fonts/icomoon.eot
  20. 14 0
      SystemAOB/functions/wifi_v1/fonts/icomoon.svg
  21. BIN
      SystemAOB/functions/wifi_v1/fonts/icomoon.ttf
  22. BIN
      SystemAOB/functions/wifi_v1/fonts/icomoon.woff
  23. BIN
      SystemAOB/functions/wifi_v1/fonts/signal-icon.eot
  24. 40 0
      SystemAOB/functions/wifi_v1/fonts/signal-icon.svg
  25. BIN
      SystemAOB/functions/wifi_v1/fonts/signal-icon.ttf
  26. BIN
      SystemAOB/functions/wifi_v1/fonts/signal-icon.woff
  27. BIN
      SystemAOB/functions/wifi_v1/getNICinfo.exe
  28. 71 0
      SystemAOB/functions/wifi_v1/hardware.php
  29. 113 0
      SystemAOB/functions/wifi_v1/ifconfig.php
  30. 100 0
      SystemAOB/functions/wifi_v1/index.php
  31. 42 0
      SystemAOB/functions/wifi_v1/iwscan.php
  32. 145 0
      SystemAOB/functions/wifi_v1/manage.php
  33. 365 0
      SystemAOB/functions/wifi_v1/network.class.php
  34. 72 0
      SystemAOB/functions/wifi_v1/opr.php
  35. 189 0
      SystemAOB/functions/wifi_v1/power.php
  36. 41 0
      SystemAOB/functions/wifi_v1/style.css
  37. 27 0
      SystemAOB/functions/wifi_v1/wpa_supplicant.conf

+ 7 - 0
System Settings/menus/network.csv

@@ -0,0 +1,7 @@
+wifi,Wifi Information (v1),SystemAOB/functions/wifi_v1/index.php
+anetwork,Available network (v1),SystemAOB/functions/wifi_v1/availablenetwork.php
+hardware,Hardware (v1),SystemAOB/functions/wifi_v1/hardware.php
+manage,Manage Wi-Fi network (v1),SystemAOB/functions/wifi_v1/manage.php
+ap,Access Point (v1),SystemAOB/functions/wifi_v1/accesspoint.php
+wpr,Power Saving (v1),SystemAOB/functions/wifi_v1/power.php
+iwsr,List iwscan (v1),SystemAOB/functions/wifi_v1/iwscan.php

+ 2 - 0
System Settings/menus/time.csv

@@ -0,0 +1,2 @@
+currtime,Time (v1),SystemAOB/functions/timezone_v1/time.php
+timezone,Timezone (v1),SystemAOB/functions/timezone_v1/index.php

+ 22 - 0
SystemAOB/functions/timezone_v1/convert.php

@@ -0,0 +1,22 @@
+<?php
+		$tzLinux = [];
+		$file = fopen("data/timezone_n.csv","r+");
+		while(! feof($file)){
+			$tmp = fgetcsv($file);
+			$tzLinux[$tmp[0]] = $tmp[1];
+		}
+		fclose($file);
+		ksort($tzLinux);
+
+		$tz = json_decode(file_get_contents('data/wintz.json'));
+		foreach($tz->{"supplementalData"}->{"windowsZones"}->{"mapTimezones"}->{"mapZone"} as $item){
+			if(isset($tzLinux[$item->{"_type"}])){
+				echo $item->{"_type"}.",".$tzLinux[$item->{"_type"}].",".$item->{"_other"}."\r\n";
+			}
+			//,$item->{"_other"}
+			//if($item->{"_type"} == $name){
+					
+					//$tz_win = $item->{"_other"};
+			//};
+		}
+?>

+ 234 - 0
SystemAOB/functions/timezone_v1/data/timezone.csv

@@ -0,0 +1,234 @@
+(GMT+00:00) Azores Time,Atlantic/Azores,Azores Standard Time
+(GMT+00:00) East Greenland Time,America/Scoresbysund,Azores Standard Time
+(GMT+00:00) Greenwich Mean Time,Etc/GMT,UTC
+(GMT+00:00) Greenwich Mean Time - Abidjan,Africa/Abidjan,Greenwich Standard Time
+(GMT+00:00) Greenwich Mean Time - Accra,Africa/Accra,Greenwich Standard Time
+(GMT+00:00) Greenwich Mean Time - Bissau,Africa/Bissau,Greenwich Standard Time
+(GMT+00:00) Greenwich Mean Time - Danmarkshavn,America/Danmarkshavn,UTC
+(GMT+00:00) Greenwich Mean Time - Monrovia,Africa/Monrovia,Greenwich Standard Time
+(GMT+00:00) Greenwich Mean Time - Reykjavik,Atlantic/Reykjavik,Greenwich Standard Time
+(GMT+00:00) Greenwich Mean Time - São Tomé,Africa/Sao_Tome,W. Central Africa Standard Time
+(GMT+01:00) Central European Standard Time - Algiers,Africa/Algiers,W. Central Africa Standard Time
+(GMT+01:00) Central European Standard Time - Tunis,Africa/Tunis,W. Central Africa Standard Time
+(GMT+01:00) Ireland Time,Europe/Dublin,GMT Standard Time
+(GMT+01:00) Morocco Time,Africa/Casablanca,Morocco Standard Time
+(GMT+01:00) United Kingdom Time,Europe/London,GMT Standard Time
+(GMT+01:00) West Africa Standard Time - Lagos,Africa/Lagos,W. Central Africa Standard Time
+(GMT+01:00) West Africa Standard Time - Ndjamena,Africa/Ndjamena,W. Central Africa Standard Time
+(GMT+01:00) Western European Time - Canary,Atlantic/Canary,GMT Standard Time
+(GMT+01:00) Western Sahara Time,Africa/El_Aaiun,Morocco Standard Time
+(GMT+02:00) Central Africa Time - Khartoum,Africa/Khartoum,Sudan Standard Time
+(GMT+02:00) Central Africa Time - Maputo,Africa/Maputo,South Africa Standard Time
+(GMT+02:00) Central Africa Time - Windhoek,Africa/Windhoek,Namibia Standard Time
+(GMT+02:00) Central European Time - Amsterdam,Europe/Amsterdam,W. Europe Standard Time
+(GMT+02:00) Central European Time - Andorra,Europe/Andorra,W. Europe Standard Time
+(GMT+02:00) Central European Time - Belgrade,Europe/Belgrade,Central Europe Standard Time
+(GMT+02:00) Central European Time - Berlin,Europe/Berlin,W. Europe Standard Time
+(GMT+02:00) Central European Time - Brussels,Europe/Brussels,Romance Standard Time
+(GMT+02:00) Central European Time - Budapest,Europe/Budapest,Central Europe Standard Time
+(GMT+02:00) Central European Time - Copenhagen,Europe/Copenhagen,Romance Standard Time
+(GMT+02:00) Central European Time - Gibraltar,Europe/Gibraltar,W. Europe Standard Time
+(GMT+02:00) Central European Time - Luxembourg,Europe/Luxembourg,W. Europe Standard Time
+(GMT+02:00) Central European Time - Malta,Europe/Malta,W. Europe Standard Time
+(GMT+02:00) Central European Time - Monaco,Europe/Monaco,W. Europe Standard Time
+(GMT+02:00) Central European Time - Oslo,Europe/Oslo,W. Europe Standard Time
+(GMT+02:00) Central European Time - Paris,Europe/Paris,Romance Standard Time
+(GMT+02:00) Central European Time - Prague,Europe/Prague,Central Europe Standard Time
+(GMT+02:00) Central European Time - Rome,Europe/Rome,W. Europe Standard Time
+(GMT+02:00) Central European Time - Stockholm,Europe/Stockholm,W. Europe Standard Time
+(GMT+02:00) Central European Time - Tirane,Europe/Tirane,Central Europe Standard Time
+(GMT+02:00) Central European Time - Vienna,Europe/Vienna,W. Europe Standard Time
+(GMT+02:00) Central European Time - Warsaw,Europe/Warsaw,Central European Standard Time
+(GMT+02:00) Central European Time - Zurich,Europe/Zurich,W. Europe Standard Time
+(GMT+02:00) Eastern European Standard Time - Cairo,Africa/Cairo,Egypt Standard Time
+(GMT+02:00) Eastern European Standard Time - Kaliningrad,Europe/Kaliningrad,Kaliningrad Standard Time
+(GMT+02:00) Eastern European Standard Time - Tripoli,Africa/Tripoli,Libya Standard Time
+(GMT+02:00) Eastern European Time (Syria) - Damascus,Asia/Damascus,Syria Standard Time
+(GMT+02:00) South Africa Standard Time,Africa/Johannesburg,South Africa Standard Time
+(GMT+03:00) Arabian Standard Time - Baghdad,Asia/Baghdad,Arabic Standard Time
+(GMT+03:00) Arabian Standard Time - Qatar,Asia/Qatar,Arab Standard Time
+(GMT+03:00) Arabian Standard Time - Riyadh,Asia/Riyadh,Arab Standard Time
+(GMT+03:00) East Africa Time - Juba,Africa/Juba,E. Africa Standard Time
+(GMT+03:00) East Africa Time - Nairobi,Africa/Nairobi,E. Africa Standard Time
+(GMT+03:00) Eastern European Time - Amman,Asia/Amman,Jordan Standard Time
+(GMT+03:00) Eastern European Time - Athens,Europe/Athens,GTB Standard Time
+(GMT+03:00) Eastern European Time - Beirut,Asia/Beirut,Middle East Standard Time
+(GMT+03:00) Eastern European Time - Bucharest,Europe/Bucharest,GTB Standard Time
+(GMT+03:00) Eastern European Time - Chisinau,Europe/Chisinau,E. Europe Standard Time
+(GMT+03:00) Eastern European Time - Hebron,Asia/Hebron,West Bank Standard Time
+(GMT+03:00) Eastern European Time - Helsinki,Europe/Helsinki,FLE Standard Time
+(GMT+03:00) Eastern European Time - Kiev,Europe/Kiev,FLE Standard Time
+(GMT+03:00) Eastern European Time - Riga,Europe/Riga,FLE Standard Time
+(GMT+03:00) Eastern European Time - Sofia,Europe/Sofia,FLE Standard Time
+(GMT+03:00) Eastern European Time - Tallinn,Europe/Tallinn,FLE Standard Time
+(GMT+03:00) Eastern European Time - Vilnius,Europe/Vilnius,FLE Standard Time
+(GMT+03:00) Israel Time,Asia/Jerusalem,Israel Standard Time
+(GMT+03:00) Moscow Standard Time - Minsk,Europe/Minsk,Belarus Standard Time
+(GMT+03:00) Moscow Standard Time - Moscow,Europe/Moscow,Russian Standard Time
+(GMT+03:00) Moscow Standard Time - Simferopol,Europe/Simferopol,Russian Standard Time
+(GMT+03:00) Syowa Time,Antarctica/Syowa,E. Africa Standard Time
+(GMT+03:00) Turkey Time,Europe/Istanbul,Turkey Standard Time
+(GMT+03:30) Iran Time,Asia/Tehran,Iran Standard Time
+(GMT+04:00) Armenia Standard Time,Asia/Yerevan,Caucasus Standard Time
+(GMT+04:00) Astrakhan Time,Europe/Astrakhan,Astrakhan Standard Time
+(GMT+04:00) Azerbaijan Standard Time,Asia/Baku,Azerbaijan Standard Time
+(GMT+04:00) Georgia Standard Time,Asia/Tbilisi,Georgian Standard Time
+(GMT+04:00) Gulf Standard Time,Asia/Dubai,Arabian Standard Time
+(GMT+04:00) Mauritius Standard Time,Indian/Mauritius,Mauritius Standard Time
+(GMT+04:00) Réunion Time,Indian/Reunion,Mauritius Standard Time
+(GMT+04:00) Samara Standard Time,Europe/Samara,Russia Time Zone 3
+(GMT+04:00) Saratov Time,Europe/Saratov,Saratov Standard Time
+(GMT+04:00) Seychelles Time,Indian/Mahe,Mauritius Standard Time
+(GMT+04:30) Afghanistan Time,Asia/Kabul,Afghanistan Standard Time
+(GMT+05:00) French Southern & Antarctic Time,Indian/Kerguelen,West Asia Standard Time
+(GMT+05:00) Maldives Time,Indian/Maldives,West Asia Standard Time
+(GMT+05:00) Mawson Time,Antarctica/Mawson,West Asia Standard Time
+(GMT+05:00) Pakistan Standard Time,Asia/Karachi,Pakistan Standard Time
+(GMT+05:00) Tajikistan Time,Asia/Dushanbe,West Asia Standard Time
+(GMT+05:00) Turkmenistan Standard Time,Asia/Ashgabat,West Asia Standard Time
+(GMT+05:00) Uzbekistan Standard Time - Tashkent,Asia/Tashkent,West Asia Standard Time
+(GMT+05:00) Yekaterinburg Standard Time,Asia/Yekaterinburg,Ekaterinburg Standard Time
+(GMT+05:30) India Standard Time - Colombo,Asia/Colombo,Sri Lanka Standard Time
+(GMT+06:00) Bangladesh Standard Time,Asia/Dhaka,Bangladesh Standard Time
+(GMT+06:00) Bhutan Time,Asia/Thimphu,Bangladesh Standard Time
+(GMT+06:00) East Kazakhstan Time - Almaty,Asia/Almaty,Central Asia Standard Time
+(GMT+06:00) Indian Ocean Time,Indian/Chagos,Central Asia Standard Time
+(GMT+06:00) Kyrgyzstan Time,Asia/Bishkek,Central Asia Standard Time
+(GMT+06:00) Omsk Standard Time,Asia/Omsk,Omsk Standard Time
+(GMT+06:00) Urumqi Time,Asia/Urumqi,Central Asia Standard Time
+(GMT+06:00) Vostok Time,Antarctica/Vostok,Central Asia Standard Time
+(GMT+06:30) Cocos Islands Time,Indian/Cocos,Myanmar Standard Time
+(GMT+07:00) Barnaul Time,Asia/Barnaul,Altai Standard Time
+(GMT+07:00) Christmas Island Time,Indian/Christmas,SE Asia Standard Time
+(GMT+07:00) Davis Time,Antarctica/Davis,SE Asia Standard Time
+(GMT+07:00) Hovd Standard Time,Asia/Hovd,W. Mongolia Standard Time
+(GMT+07:00) Indochina Time - Bangkok,Asia/Bangkok,SE Asia Standard Time
+(GMT+07:00) Krasnoyarsk Standard Time - Krasnoyarsk,Asia/Krasnoyarsk,North Asia Standard Time
+(GMT+07:00) Novosibirsk Standard Time,Asia/Novosibirsk,N. Central Asia Standard Time
+(GMT+07:00) Tomsk Time,Asia/Tomsk,Tomsk Standard Time
+(GMT+08:00) Australian Western Standard Time - Casey,Antarctica/Casey,W. Australia Standard Time
+(GMT+08:00) Australian Western Standard Time - Perth,Australia/Perth,W. Australia Standard Time
+(GMT+08:00) Brunei Darussalam Time,Asia/Brunei,Singapore Standard Time
+(GMT+08:00) Central Indonesia Time,Asia/Makassar,Singapore Standard Time
+(GMT+08:00) China Standard Time - Macao,Asia/Macau,China Standard Time
+(GMT+08:00) China Standard Time - Shanghai,Asia/Shanghai,China Standard Time
+(GMT+08:00) Hong Kong Standard Time,Asia/Hong_Kong,China Standard Time
+(GMT+08:00) Irkutsk Standard Time,Asia/Irkutsk,North Asia East Standard Time
+(GMT+08:00) Philippine Standard Time,Asia/Manila,Singapore Standard Time
+(GMT+08:00) Singapore Standard Time,Asia/Singapore,Singapore Standard Time
+(GMT+08:00) Taipei Standard Time,Asia/Taipei,Taipei Standard Time
+(GMT+08:00) Ulaanbaatar Standard Time,Asia/Ulaanbaatar,Ulaanbaatar Standard Time
+(GMT+08:45) Australian Central Western Standard Time,Australia/Eucla,Aus Central W. Standard Time
+(GMT+09:00) East Timor Time,Asia/Dili,Tokyo Standard Time
+(GMT+09:00) Eastern Indonesia Time,Asia/Jayapura,Tokyo Standard Time
+(GMT+09:00) Japan Standard Time,Asia/Tokyo,Tokyo Standard Time
+(GMT+09:00) Korean Standard Time - Pyongyang,Asia/Pyongyang,North Korea Standard Time
+(GMT+09:00) Korean Standard Time - Seoul,Asia/Seoul,Korea Standard Time
+(GMT+09:00) Palau Time,Pacific/Palau,Tokyo Standard Time
+(GMT+09:00) Yakutsk Standard Time - Chita,Asia/Chita,Transbaikal Standard Time
+(GMT+09:00) Yakutsk Standard Time - Yakutsk,Asia/Yakutsk,Yakutsk Standard Time
+(GMT+09:30) Australian Central Standard Time,Australia/Darwin,AUS Central Standard Time
+(GMT+10:00) Australian Eastern Standard Time - Brisbane,Australia/Brisbane,E. Australia Standard Time
+(GMT+10:00) Chamorro Standard Time,Pacific/Guam,West Pacific Standard Time
+(GMT+10:00) Dumont-d'Urville Time,Antarctica/DumontDUrville,West Pacific Standard Time
+(GMT+10:00) Papua New Guinea Time,Pacific/Port_Moresby,West Pacific Standard Time
+(GMT+10:00) Vladivostok Standard Time - Vladivostok,Asia/Vladivostok,Vladivostok Standard Time
+(GMT+10:30) Central Australia Time - Adelaide,Australia/Adelaide,Cen. Australia Standard Time
+(GMT+11:00) Bougainville Time,Pacific/Bougainville,Bougainville Standard Time
+(GMT+11:00) Eastern Australia Time - Hobart,Australia/Hobart,Tasmania Standard Time
+(GMT+11:00) Eastern Australia Time - Sydney,Australia/Sydney,AUS Eastern Standard Time
+(GMT+11:00) Lord Howe Time,Australia/Lord_Howe,Lord Howe Standard Time
+(GMT+11:00) Macquarie Island Time,Antarctica/Macquarie,Central Pacific Standard Time
+(GMT+11:00) Magadan Standard Time,Asia/Magadan,Magadan Standard Time
+(GMT+11:00) New Caledonia Standard Time,Pacific/Noumea,Central Pacific Standard Time
+(GMT+11:00) Norfolk Island Time,Pacific/Norfolk,Norfolk Standard Time
+(GMT+11:00) Sakhalin Standard Time,Asia/Sakhalin,Sakhalin Standard Time
+(GMT+11:00) Solomon Islands Time,Pacific/Guadalcanal,Central Pacific Standard Time
+(GMT+11:00) Srednekolymsk Time,Asia/Srednekolymsk,Russia Time Zone 10
+(GMT+11:00) Vanuatu Standard Time,Pacific/Efate,Central Pacific Standard Time
+(GMT+12:00) Fiji Time,Pacific/Fiji,Fiji Standard Time
+(GMT+12:00) Gilbert Islands Time,Pacific/Tarawa,UTC+12
+(GMT+12:00) Nauru Time,Pacific/Nauru,UTC+12
+(GMT+12:00) Petropavlovsk-Kamchatski Standard Time,Asia/Kamchatka,Russia Time Zone 11
+(GMT+12:00) Tuvalu Time,Pacific/Funafuti,UTC+12
+(GMT+12:00) Wake Island Time,Pacific/Wake,UTC+12
+(GMT+12:00) Wallis & Futuna Time,Pacific/Wallis,UTC+12
+(GMT+13:00) New Zealand Time,Pacific/Auckland,New Zealand Standard Time
+(GMT+13:00) Phoenix Islands Time,Pacific/Enderbury,UTC+13
+(GMT+13:00) Tokelau Time,Pacific/Fakaofo,UTC+13
+(GMT+13:00) Tonga Standard Time,Pacific/Tongatapu,Tonga Standard Time
+(GMT+13:45) Chatham Time,Pacific/Chatham,Chatham Islands Standard Time
+(GMT+14:00) Apia Time,Pacific/Apia,Samoa Standard Time
+(GMT+14:00) Line Islands Time,Pacific/Kiritimati,Line Islands Standard Time
+(GMT-01:00) Cape Verde Standard Time,Atlantic/Cape_Verde,Cape Verde Standard Time
+(GMT-02:00) Fernando de Noronha Standard Time,America/Noronha,UTC-02
+(GMT-02:00) South Georgia Time,Atlantic/South_Georgia,UTC-02
+(GMT-02:00) St. Pierre & Miquelon Time,America/Miquelon,Saint Pierre Standard Time
+(GMT-02:00) West Greenland Time,America/Godthab,Greenland Standard Time
+(GMT-02:30) Newfoundland Time,America/St_Johns,Newfoundland Standard Time
+(GMT-03:00) Atlantic Time - Bermuda,Atlantic/Bermuda,Atlantic Standard Time
+(GMT-03:00) Atlantic Time - Halifax,America/Halifax,Atlantic Standard Time
+(GMT-03:00) Atlantic Time - Thule,America/Thule,Atlantic Standard Time
+(GMT-03:00) Brasilia Standard Time - Araguaina,America/Araguaina,Tocantins Standard Time
+(GMT-03:00) Brasilia Standard Time - Bahia,America/Bahia,Bahia Standard Time
+(GMT-03:00) Brasilia Standard Time - Sao Paulo,America/Sao_Paulo,E. South America Standard Time
+(GMT-03:00) Chile Time,America/Santiago,Pacific SA Standard Time
+(GMT-03:00) Falkland Islands Standard Time,Atlantic/Stanley,SA Eastern Standard Time
+(GMT-03:00) French Guiana Time,America/Cayenne,SA Eastern Standard Time
+(GMT-03:00) Palmer Time,Antarctica/Palmer,Magallanes Standard Time
+(GMT-03:00) Paraguay Time,America/Asuncion,Paraguay Standard Time
+(GMT-03:00) Punta Arenas Time,America/Punta_Arenas,Magallanes Standard Time
+(GMT-03:00) Rothera Time,Antarctica/Rothera,SA Eastern Standard Time
+(GMT-03:00) Suriname Time,America/Paramaribo,SA Eastern Standard Time
+(GMT-03:00) Uruguay Standard Time,America/Montevideo,Montevideo Standard Time
+(GMT-04:00) Amazon Standard Time - Cuiaba,America/Cuiaba,Central Brazilian Standard Time
+(GMT-04:00) Atlantic Standard Time - Barbados,America/Barbados,SA Western Standard Time
+(GMT-04:00) Atlantic Standard Time - Blanc-Sablon,America/Blanc-Sablon,SA Western Standard Time
+(GMT-04:00) Atlantic Standard Time - Curaçao,America/Curacao,SA Western Standard Time
+(GMT-04:00) Atlantic Standard Time - Martinique,America/Martinique,SA Western Standard Time
+(GMT-04:00) Atlantic Standard Time - Port of Spain,America/Port_of_Spain,SA Western Standard Time
+(GMT-04:00) Atlantic Standard Time - Puerto Rico,America/Puerto_Rico,SA Western Standard Time
+(GMT-04:00) Atlantic Standard Time - Santo Domingo,America/Santo_Domingo,SA Western Standard Time
+(GMT-04:00) Bolivia Time,America/La_Paz,SA Western Standard Time
+(GMT-04:00) Cuba Time,America/Havana,Cuba Standard Time
+(GMT-04:00) Eastern Time - Grand Turk,America/Grand_Turk,Turks And Caicos Standard Time
+(GMT-04:00) Eastern Time - Nassau,America/Nassau,Eastern Standard Time
+(GMT-04:00) Eastern Time - New York,America/New_York,Eastern Standard Time
+(GMT-04:00) Eastern Time - Port-au-Prince,America/Port-au-Prince,Haiti Standard Time
+(GMT-04:00) Guyana Time,America/Guyana,SA Western Standard Time
+(GMT-04:00) Venezuela Time,America/Caracas,Venezuela Standard Time
+(GMT-05:00) Central Time - Chicago,America/Chicago,Central Standard Time
+(GMT-05:00) Central Time - Matamoros,America/Matamoros,Central Standard Time
+(GMT-05:00) Central Time - Mexico City,America/Mexico_City,Central Standard Time (Mexico)
+(GMT-05:00) Colombia Standard Time,America/Bogota,SA Pacific Standard Time
+(GMT-05:00) Easter Island Time,Pacific/Easter,Easter Island Standard Time
+(GMT-05:00) Eastern Standard Time - Cancun,America/Cancun,Eastern Standard Time (Mexico)
+(GMT-05:00) Eastern Standard Time - Jamaica,America/Jamaica,SA Pacific Standard Time
+(GMT-05:00) Eastern Standard Time - Panama,America/Panama,SA Pacific Standard Time
+(GMT-05:00) Ecuador Time,America/Guayaquil,SA Pacific Standard Time
+(GMT-05:00) Peru Standard Time,America/Lima,SA Pacific Standard Time
+(GMT-06:00) Central Standard Time - Belize,America/Belize,Central America Standard Time
+(GMT-06:00) Central Standard Time - Costa Rica,America/Costa_Rica,Central America Standard Time
+(GMT-06:00) Central Standard Time - El Salvador,America/El_Salvador,Central America Standard Time
+(GMT-06:00) Central Standard Time - Guatemala,America/Guatemala,Central America Standard Time
+(GMT-06:00) Central Standard Time - Managua,America/Managua,Central America Standard Time
+(GMT-06:00) Central Standard Time - Regina,America/Regina,Canada Central Standard Time
+(GMT-06:00) Central Standard Time - Tegucigalpa,America/Tegucigalpa,Central America Standard Time
+(GMT-06:00) Galapagos Time,Pacific/Galapagos,Central America Standard Time
+(GMT-06:00) Mexican Pacific Time - Chihuahua,America/Chihuahua,Mountain Standard Time (Mexico)
+(GMT-06:00) Mountain Time - Denver,America/Denver,Mountain Standard Time
+(GMT-06:00) Mountain Time - Ojinaga,America/Ojinaga,Mountain Standard Time
+(GMT-07:00) Mexican Pacific Standard Time,America/Hermosillo,US Mountain Standard Time
+(GMT-07:00) Mountain Standard Time - Phoenix,America/Phoenix,US Mountain Standard Time
+(GMT-07:00) Pacific Time - Los Angeles,America/Los_Angeles,Pacific Standard Time
+(GMT-07:00) Pacific Time - Tijuana,America/Tijuana,Pacific Standard Time (Mexico)
+(GMT-08:00) Alaska Time - Anchorage,America/Anchorage,Alaskan Standard Time
+(GMT-08:00) Pitcairn Time,Pacific/Pitcairn,UTC-08
+(GMT-09:00) Gambier Time,Pacific/Gambier,UTC-09
+(GMT-09:00) Hawaii-Aleutian Time (Adak),America/Adak,Aleutian Standard Time
+(GMT-09:30) Marquesas Time,Pacific/Marquesas,Marquesas Standard Time
+(GMT-10:00) Cook Islands Standard Time,Pacific/Rarotonga,Hawaiian Standard Time
+(GMT-10:00) Hawaii-Aleutian Standard Time,Pacific/Honolulu,Hawaiian Standard Time
+(GMT-10:00) Tahiti Time,Pacific/Tahiti,Hawaiian Standard Time
+(GMT-11:00) Niue Time,Pacific/Niue,UTC-11
+(GMT-11:00) Samoa Standard Time,Pacific/Pago_Pago,UTC-11

BIN
SystemAOB/functions/timezone_v1/getTime.exe


+ 99 - 0
SystemAOB/functions/timezone_v1/index.php

@@ -0,0 +1,99 @@
+
+<!DOCTYPE html>
+<meta name="apple-mobile-web-app-capable" content="yes" />
+<meta name="viewport" content="user-scalable=no, width=device-width, initial-scale=0.6, maximum-scale=0.6"/>
+<html>
+<head>
+<meta charset="UTF-8">
+<script type='text/javascript' charset='utf-8'>
+    // Hides mobile browser's address bar when page is done loading.
+      window.addEventListener('load', function(e) {
+        setTimeout(function() { window.scrollTo(0, 1); }, 1);
+      }, false);
+</script>
+<title>ArOZ Onlineβ</title>
+<link rel="stylesheet" href="../../../script/tocas/tocas.css">
+<script src="../../../script/tocas/tocas.js"></script>
+<script src="../../../script/jquery.min.js"></script>
+</head>
+<body style="background-color: rgb(247, 247, 247);">
+<div class="ts container">
+<br>
+<div class="ts segment">
+	<div class="ts header">
+    Timezone configuration
+    <div class="sub header">You could change the timezone.</div>
+	</div>
+</div>
+<div class="ts divider"></div>
+<div class="ts segment">
+	<div class="ts divided items">
+		<div class="ts form">
+			<div class="field">
+				<label>Change timezone</label>
+				<select id="tz">
+				</select>
+			</div>
+			<div class="field">
+				<button class="ts button" onclick="changetimezone()">Apply</button>
+			</div>
+		</div>
+		<p>
+		The system synchronizes to NTP server.
+		</p>
+	</div>
+</div>
+<br><br><br>
+</div>
+</div>
+
+<div class="ts bottom right snackbar">
+	<div class="content"></div>	
+</div>
+<script>
+var computerTZ = Intl.DateTimeFormat().resolvedOptions().timeZone;
+var serverTZ = "";
+update();
+
+function update(){
+	$.get("opr.php?opr=query", function (data) {
+		var currTime = JSON.parse(data);
+		serverTZ = currTime["timezone"];
+		updatelist();
+	});
+}
+
+function updatelist(){
+	$("#tz").html('<option linuxtz="NA" wintz="NA">Updating...</option>');
+	$.get("opr.php?opr=alltimezone", function (data) {
+		$("#tz").html("");
+		var timezone = JSON.parse(data);
+		$.each(timezone, function(i, field){
+			var friendlyname = field[0];
+			if(serverTZ == field[1]){
+				friendlyname = friendlyname + " (Current)";
+			}
+			if(computerTZ == field[1]){
+				friendlyname = friendlyname + " (Suggested)";
+			}
+			$("#tz").append('<option linuxtz="' + field[1] + '" wintz="' + field[2] + '">' + friendlyname + "</option>");
+	   });
+	   $('#tz option[linuxtz="' + serverTZ + '"]').attr('selected','selected');
+	});
+}
+
+function changetimezone(){
+	$.ajax({url:"opr.php?opr=modify&tz=" + $('#tz option:selected').attr('linuxtz'),async:false});
+	msg("Success.");
+	update();
+}
+
+function msg(content) {
+	ts('.snackbar').snackbar({
+		content: content,
+		actionEmphasis: 'negative',
+	});
+}
+</script>
+</body>
+</html>

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

@@ -0,0 +1,51 @@
+<?php
+// Read timezone DB
+	$timezone = [];
+	$file = fopen("data/timezone.csv","r");
+	while(! feof($file)){
+		$tmp = fgetcsv($file);
+		//print_r($tmp);
+		array_push($timezone,array($tmp[0],$tmp[1],$tmp[2]));
+	}
+	fclose($file);
+// END
+
+if($_GET["opr"] == "query"){
+	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+		$result["f_timezone"] = exec("tzutil /g");
+		foreach ($timezone as $tz) {
+			if($tz[2] == $result["f_timezone"]){
+				$result["timezone"] = $tz[1];
+			}
+		}	
+		$result["fulltime"] = exec('getTime.exe');
+		$result["time"] =  explode(" ",exec('getTime.exe'))[1]." ".explode(" ",exec('getTime.exe'))[2];
+	}else{
+		$result["timezone"] = exec("cat /etc/timezone");
+		foreach ($timezone as $tz) {
+			if($tz[1] == $result["timezone"]){
+				$result["f_timezone"] = $tz[2];
+			}
+		}
+		$result["fulltime"] = exec('date +"%a %Y-%m-%d %T %Z %z"');
+		$result["time"] = exec('date +"%Y-%m-%d %T"');
+	}
+	echo json_encode($result);
+}else if($_GET["opr"] == "alltimezone"){
+	echo json_encode($timezone);
+}else if($_GET["opr"] == "modify"){
+	if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
+		$tz_win = "";
+		foreach ($timezone as $tz) {
+			if($tz[1] == $_GET["tz"]){
+				$tz_win = $tz[2];
+			}
+		}
+		exec('tzutil /s "'.$tz_win.'"');
+		echo "Finish";
+	}else{
+		exec("sudo timedatectl set-timezone '".$_GET["tz"]."'");
+		echo "Finish";
+	}
+}
+?>

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

@@ -0,0 +1,35 @@
+<?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.'"';
+
+?>

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

@@ -0,0 +1,32 @@
+<?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);
+
+?>

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

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

+ 104 - 0
SystemAOB/functions/timezone_v1/time.php

@@ -0,0 +1,104 @@
+<?php
+include '../../../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+      <title>Default Page</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+	  <style>
+	  </style>
+   </head>
+
+
+<body style="background-color: rgb(247, 247, 247);">
+<div class="ts container">
+<br>
+<div class="ts segment">
+	<div class="ts header">
+    Current system time
+    <div class="sub header">You could see the system time right here.</div>
+	</div>
+</div>
+<div class="ts divider"></div>
+<div class="ts segment">
+	<div class="ts divided items">
+		<h2 class="ts header" id="CurrTime">Loading...</h2>
+		<br>
+		<p id="timediff"></p>
+	</div>
+</div>
+
+      <div class="ts snackbar">
+         <div class="content"></div>	
+      </div>
+<script>
+startup();
+var cur = new Date("1900-01-01 00:00:00");
+var tz = "";
+
+function startup(){
+//Please ADD ALL LOAD ON STARTUP SCRIPT HERE
+UpdateTime();
+setInterval(ShowTime, 1000);
+setInterval(UpdateTime, 30000);
+os();
+}
+
+function ShowTime(){
+	cur.setSeconds(cur.getSeconds() + 1);
+	var formatted = cur.toLocaleDateString('en-US') + " " + cur.toLocaleTimeString('en-US');	 
+	$( "#CurrTime" ).html(formatted + " ("+ tz + ")");
+	}
+
+function UpdateTime(){
+	
+	$.getJSON("opr.php?opr=query", function (data) {
+		cur = new Date(data["time"]);
+		tz = data["f_timezone"];
+		
+		var timediff = (new Date() - cur);
+		if(timediff >= 0){
+			$("#timediff").text("This computer time was " + convert(timediff) + " ahead.");
+		}else{
+			$("#timediff").text("This computer time was lagging behind " + convert((-1*timediff)) + ".");
+		}
+	});
+}
+
+function convert(timediff){
+		if(timediff < 1000){
+			return timediff + "ms";
+		}else if(timediff < 60000){
+			return Math.floor(timediff/1000) + "s " + convert(timediff-Math.floor(timediff/1000)*1000);
+		}else if(timediff < 3600000){
+			return Math.floor(timediff/60000) + "m " + convert(timediff-Math.floor(timediff/60000)*60000);
+		}else if(timediff < 216000000){
+			return Math.floor(timediff/3600000) + "h " + convert(timediff-Math.floor(timediff/3600000)*3600000);
+		}	
+}
+
+function msg(content) {
+	ts('.snackbar').snackbar({
+		content: content,
+		actionEmphasis: 'negative',
+	});
+}
+
+function os(){
+	<?php
+	if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+		echo "console.log('WIN');";
+	}else{
+		echo "console.log('LINUX');";
+	}
+	?>
+}
+
+</script>
+</body>
+</html>

+ 6 - 0
SystemAOB/functions/wifi_v1/NICinfo.txt

@@ -0,0 +1,6 @@
+Intel(R) Ethernet Connection I217-V,區域連線,Enabled
+Realtek RTL8192CU Wireless LAN 802.11n USB 2.0 Network Adapter,無線網路連線,Enabled
+Software Loopback Interface 1,Loopback Pseudo-Interface 1,Enabled
+Microsoft ISATAP Adapter,isatap.{82235798-BB3A-44A3-9EBE-BA2E596DBBED},Enabled
+Microsoft ISATAP Adapter #2,isatap.{46790D14-4B0E-4527-AD80-5EA3192B8803},Enabled
+Teredo Tunneling Pseudo-Interface,Teredo Tunneling Pseudo-Interface,Enabled

+ 91 - 0
SystemAOB/functions/wifi_v1/accesspoint.php

@@ -0,0 +1,91 @@
+<?php
+include '../../../auth.php';
+?>
+
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+      <title>WIFI</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+   </head>
+
+
+<body>
+<div class="ts fluid borderless slate">
+	<div class="ts segment" style="width:100%;">
+		<div class="ts header">
+			AP Settings
+			<div class="sub header">AP SSID and Password can be modified here.</div>
+		</div>
+	</div>
+	<div class="ts container">
+
+
+	</div>
+</div>
+<br>
+<div class="ts container">
+<form id="form" class="ts form" id="wifi" action="">
+<table>
+   <tr>
+      <td>AP SSID</td>
+      <td>
+         <div class="ts mini fluid input"><input name="ssid" id="ssid" type="text" placeholder="SSID"></div>
+      </td>
+   </tr>
+   <tr>
+      <td>AP Password</td>
+      <td>
+         <div class="ts mini fluid input"><input type="password" placeholder="Password" id="psk" name="psk" pattern="[a-zA-Z0-9]{8,}"></div>
+      </td>
+   </tr>
+</table>
+</form>
+<table>
+   <tr>
+      <td colspan="2"><button onclick="update()" class="ts basic button">Update</button></td>
+   </tr>
+   </table>
+	</div>
+		
+
+      <div class="ts snackbar">
+         <div class="content"></div>
+         <a class="action"></a>
+      </div>
+<script>
+startup();
+
+function startup(){
+//Please ADD ALL LOAD ON STARTUP SCRIPT HERE
+loadstatus();
+}
+
+function loadstatus(){
+$.getJSON("opr.php?opr=viewapsetting", function (data) {
+	$("#ssid").val(data["ssid"]);
+	$("#psk").val(data["wpa_passphrase"]);
+});
+}
+
+function msg(content) {
+		ts('.snackbar').snackbar({
+			content: content,
+			actionEmphasis: 'negative',
+		});
+}
+
+function update(){
+	$.post( "opr.php?opr=setap", $( "#form" ).serialize()).done(function() {
+		msg("AP Settings Updated. Changes will be made after reboot.");
+	});
+}
+
+</script>
+</body>
+</html>

+ 97 - 0
SystemAOB/functions/wifi_v1/addnew.php

@@ -0,0 +1,97 @@
+<?php
+include '../../../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+      <title>WIFI</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+   </head>
+
+
+<body>
+<div class="ts fluid borderless slate">
+	<div class="ts segment" style="width:100%;">
+		<div class="ts header">
+			Add new Wi-Fi network
+			<div class="sub header">Connect Wi-Fi.</div>
+		</div>
+	</div>
+	<div class="ts container">
+
+
+	</div>
+</div>
+<br>
+<div class="ts container">
+<form id="form" class="ts form" id="wifi" action="">
+    <div class="field">
+        <label>Encryption method</label>
+        <select name="encryption" id="encryption">
+			<option>Select</option>
+            <option id="WPA2">WPA2</option>
+            <option id="802.1x">802.1x</option>
+            <option id="no">no</option>
+        </select>
+    </div>
+	<div id="info"></div>
+</form>
+	<br><button class="ts button" onclick="submit()">Add</button>	
+		
+	</div>
+	
+<div id="msgbox" class="ts bottom right snackbar">
+    <div class="content">
+        Your request is processing now.
+    </div>
+</div>
+<script>
+startup();
+
+
+
+function startup(){
+//Please ADD ALL LOAD ON STARTUP SCRIPT HERE
+
+}
+
+$( "#encryption" ).change(function() {
+  form(this);
+});
+
+function form(method){
+if($(method).val() == "WPA2"){
+	$( "#info" ).html('<div class="sixteen wide field"><input id="ssid" name="ssid" placeholder="SSID" type="text"></div><div class="sixteen wide field"><input id="psk" name="psk" placeholder="Password" type="password"></div>');
+}else if($(method).val() == "802.1x"){
+	$( "#info" ).html('<div class="sixteen wide field"><input id="ssid" name="ssid" placeholder="SSID" type="text"></div><div class="sixteen wide field"><input id="identity" name="identity" placeholder="Username" type="text"></div><div class="sixteen wide field"><input ut id="psk" name="psk" placeholder="Password" type="password"></div>');
+}else if($(method).val() == "no"){
+	$( "#info" ).html('<div class="sixteen wide field"><input id="ssid" name="ssid" placeholder="SSID" type="text"></div>');
+}
+}
+
+function msg(content) {
+		ts('.snackbar').snackbar({
+			content: content,
+			actionEmphasis: 'negative',
+		});
+}
+	
+function submit(){
+	$.post( "opr.php?opr=addwifi", $( "#form" ).serialize()).done(function() {
+		msg("WPA Updated. Restarting wireless interface services.");
+	$.ajax({url:"opr.php?opr=restart",async:false});
+		msg('Added Wi-Fi Network.');
+		scannetwork();
+  })
+  .fail(function() {
+    msg( "Failed" );
+  });
+}	
+</script>
+
+</body>
+</html>

+ 180 - 0
SystemAOB/functions/wifi_v1/availablenetwork.php

@@ -0,0 +1,180 @@
+<?php
+include '../../../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+	  <link rel="stylesheet" href="style.css">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+      <title>WIFI</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+   </head>
+
+
+<body>
+<div class="ts fluid borderless slate">
+	<div class="ts segment" style="width:100%;">
+		<div class="ts header">
+			Connect New Wi-Fi Network
+			<div class="sub header">All the WiFi SSID scanned within the range of the onboard WLAN card.</div>
+		</div>
+	</div>
+	<div class="ts container">
+
+
+	</div>
+</div>
+<br>
+<?php
+if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+    echo '<div class="ts message">
+    <div class="header">Not Supported OS</div>
+    <p>This function is not supported in Windows Host.</p>
+</div>';
+	exit(0);
+} 
+?>
+<div class="ts container">
+<div class="ts cards" id="main_wifi">
+
+</div>
+
+		
+		
+	</div>
+<div class="ts modals dimmer">
+<dialog class="ts basic modal" id="modal" style="background-color:white" close>
+    <div class="header" style="color:black" id="head_modal">
+       
+    </div>
+	<div class="content" style="color:black" id="content_modal">
+		
+    </div>
+	<div class="actions">
+        <Button class="ts primary button" id="connect_btn">Connect</button>
+			<button class="ts negative button">Cancel</button>
+    </div>
+</dialog>
+</div>
+
+<div id="msgbox" class="ts bottom right snackbar">
+    <div class="content">
+        Your request is being processed now.
+    </div>
+</div>
+<script>
+startup();
+
+var previouswifi;
+
+function startup(){
+//Please ADD ALL LOAD ON STARTUP SCRIPT HERE
+	scannetwork();
+}
+
+function scannetwork(){
+		$('#main_wifi').html("");
+		 $("#availablewifi").html('<tr><th>Wi-Fi name</th></tr>');		 
+		$.ajaxSettings.async = false; 
+		$.getJSON("opr.php?opr=scan", function(result){
+            $.each(result, function(i, field){
+					var Quality = "icon-0";
+					var Quality_int = parseInt(field["Quality"].split("/")[0])/parseInt(field["Quality"].split("/")[1]);
+					if(Quality_int == 0){
+						Quality = "icon-0";
+					}else if(Quality_int > 0 && Quality_int <= 0.25){
+						Quality = "icon-1";
+					}else if(Quality_int > 0.25 && Quality_int <= 0.5){
+						Quality = "icon-2";
+					}else if(Quality_int > 0.5 && Quality_int <= 0.75){
+						Quality = "icon-3";
+					}else if(Quality_int > 0.75 && Quality_int <= 1){
+						Quality = "icon-Full";
+					}
+					$('#main_wifi').append('<div class="ts card"><div class="content"><div class="ts medium comments"><div class="comment"><div class="avatar"><span class="' + Quality + '" style="font-size:2.5em"></span></div><div class="content"><p class="author">' + field["ESSID"] + '</p><div class="text">' + field["Encrpytion_Method"] + '</div><div class="actions" id="act_wifi"><a onclick="conn_modal(this)" ssid="' + field["ESSID"] + '" encrypt="' + field["Encrpytion_Method_Shortname"] + '">Connect</a></div></div></div></div></div></div>');
+            });
+        });
+		$("#main_wifi").append('<div class="ts card"><div class="content"><div class="ts medium comments"><div class="comment"><div class="avatar"><i class="big add icon"></i></div><div class="content"><a class="author">Add new Wi-Fi</a><div class="text">Add new network</div><div class="actions"><a onclick="redirect()">Add</a></div></div></div></div></div></div>');
+		$.ajaxSettings.async = true; 
+
+}
+
+// not fixed
+function redirect(){
+	window.location = "addnew.php";
+}
+//
+
+function conn_modal(ssid){
+	var method = "";
+	if($(ssid).attr("encrypt") == "No"){
+		method = "no";
+	}else if($(ssid).attr("encrypt") == "802.1x"){
+		method = "802.1x"
+	}else if($(ssid).attr("encrypt") == "WPA2"){
+		method = "WPA2"
+	}
+	
+		ts('#modal').modal({
+			approve: '.primary',
+			deny: '.negative',
+			onDeny: function() {
+				msg("Cancelled");
+			},
+			onApprove: function() {
+				submit($(ssid).attr('ssid'),method);
+			}
+		}).modal("show");
+	$('#head_modal').html("Connecting to : " + $(ssid).attr('ssid'));
+	$('#content_modal').html('<form id="form" class="ts form" id="wifi" action=""><div class="fields">' + form($(ssid).attr('encrypt')) +'</div><input type="hidden" id="ssid" name="ssid" value="' + $(ssid).attr('ssid') + '"><input type="hidden" id="encryption" name="encryption" value="' + method + '"></form>');
+	
+	var saved=false;
+	$("#connect_btn").removeAttr("disabled");
+	$.getJSON("opr.php?opr=view_wifistorage", function(result){
+           $.each(result, function(i, wifiarray){
+			if(wifiarray["ssid"] == $(ssid).attr("ssid")){
+				saved=true;
+				$('#content_modal').html("Record already exists. You have to remove the WiFi Network Record before reconnecting.");
+	$("#connect_btn").attr("disabled","true");
+			}
+		});
+    });
+}
+
+function form(method){
+console.log(method);
+if(method == "WPA2"){
+	return '<div class="sixteen wide field"><input id="psk" name="psk" placeholder="Password" type="password"></div>';
+}else if(method == "802.1x"){
+	return '<div class="eight wide field"><input id="identity" name="identity" placeholder="Username" type="text"></div><div class="eight wide field"><input ut id="psk" name="psk" placeholder="Password" type="password"></div>';
+}else if(method == "No"){
+	return 'Open Network. No Password Required';
+}else{
+	return 'System cannot determine wifi encrpyion method.';
+}
+}
+
+function msg(content) {
+		ts('.snackbar').snackbar({
+			content: content,
+			actionEmphasis: 'negative',
+		});
+}
+	
+function submit(){
+	$.post( "opr.php?opr=addwifi", $( "#form" ).serialize()).done(function() {
+		msg("WPA Updated. Restarting wireless interface services.");
+	$.ajax({url:"opr.php?opr=restart",async:false});
+		msg('Added Wi-Fi Network.');
+  })
+  .fail(function() {
+    msg( "Failed" );
+  });
+}	
+</script>
+
+</body>
+</html>

BIN
SystemAOB/functions/wifi_v1/fonts/Ethernet.png


BIN
SystemAOB/functions/wifi_v1/fonts/Unknwon.png


BIN
SystemAOB/functions/wifi_v1/fonts/WiFi.png


BIN
SystemAOB/functions/wifi_v1/fonts/icomoon.eot


+ 14 - 0
SystemAOB/functions/wifi_v1/fonts/icomoon.svg

@@ -0,0 +1,14 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>Generated by IcoMoon</metadata>
+<defs>
+<font id="icomoon" horiz-adv-x="1024">
+<font-face units-per-em="1024" ascent="960" descent="-64" />
+<missing-glyph horiz-adv-x="1024" />
+<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
+<glyph unicode="&#xe900;" glyph-name="Full" horiz-adv-x="1105" d="M530.286 515.048v-536.381c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v536.381c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM814.73 718.222v-739.556c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v739.556c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM245.841 311.873v-333.206c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v333.206c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM1099.175 921.397v-942.73c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v942.73c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe902;" glyph-name="1" horiz-adv-x="1105" d="M251.969 308.913v-330.583c0-20.039-16.245-36.283-36.283-36.283h-169.323c-20.039 0-36.283 16.245-36.283 36.283v330.583c0 20.039 16.245 36.283 36.283 36.283h169.323c20.039 0 36.283-16.245 36.283-36.283z" />
+<glyph unicode="&#xe903;" glyph-name="2" horiz-adv-x="1105" d="M534.173 510.488v-532.157c0-20.039-16.245-36.283-36.283-36.283h-169.323c-20.039 0-36.283 16.245-36.283 36.283v532.157c0 20.039 16.245 36.283 36.283 36.283h169.323c20.039 0 36.283-16.245 36.283-36.283zM251.969 308.913v-330.583c0-20.039-16.245-36.283-36.283-36.283h-169.323c-20.039 0-36.283 16.245-36.283 36.283v330.583c0 20.039 16.245 36.283 36.283 36.283h169.323c20.039 0 36.283-16.245 36.283-36.283z" />
+<glyph unicode="&#xe904;" glyph-name="3" horiz-adv-x="1105" d="M534.173 510.488v-532.157c0-20.039-16.245-36.283-36.283-36.283h-169.323c-20.039 0-36.283 16.245-36.283 36.283v532.157c0 20.039 16.245 36.283 36.283 36.283h169.323c20.039 0 36.283-16.245 36.283-36.283zM816.378 712.063v-733.732c0-20.039-16.245-36.283-36.283-36.283h-169.323c-20.039 0-36.283 16.245-36.283 36.283v733.732c0 20.039 16.245 36.283 36.283 36.283h169.323c20.039 0 36.283-16.245 36.283-36.283zM251.969 308.913v-330.583c0-20.039-16.245-36.283-36.283-36.283h-169.323c-20.039 0-36.283 16.245-36.283 36.283v330.583c0 20.039 16.245 36.283 36.283 36.283h169.323c20.039 0 36.283-16.245 36.283-36.283z" />
+</font></defs></svg>

BIN
SystemAOB/functions/wifi_v1/fonts/icomoon.ttf


BIN
SystemAOB/functions/wifi_v1/fonts/icomoon.woff


BIN
SystemAOB/functions/wifi_v1/fonts/signal-icon.eot


+ 40 - 0
SystemAOB/functions/wifi_v1/fonts/signal-icon.svg

@@ -0,0 +1,40 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" >
+<svg xmlns="http://www.w3.org/2000/svg">
+<metadata>
+<json>
+<![CDATA[
+{
+	"fontFamily": "signal-icon",
+	"majorVersion": 1,
+	"minorVersion": 0,
+	"version": "Version 1.0",
+	"fontId": "signal-icon",
+	"psName": "signal-icon",
+	"subFamily": "Regular",
+	"fullName": "signal-icon",
+	"description": "Font generated by IcoMoon."
+}
+]]>
+</json>
+</metadata>
+<defs>
+<font id="signal-icon" horiz-adv-x="1024">
+<font-face units-per-em="1024" ascent="960" descent="-64" />
+<missing-glyph horiz-adv-x="1024" />
+<glyph unicode="&#x20;" horiz-adv-x="512" d="" />
+<glyph unicode="&#xe900;" glyph-name="zero" data-tags="0" horiz-adv-x="1105" d="M530.286 515.048v-536.381c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v536.381c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM814.73 718.222v-739.556c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v739.556c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM245.841 311.873v-333.206c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v333.206c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM1099.175 921.397v-942.73c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v942.73c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe901;" horiz-adv-x="1105" d="M530.286 515.048v-536.381c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v536.381c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe902;" horiz-adv-x="1105" d="M814.73 718.222v-739.556c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v739.556c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe903;" horiz-adv-x="1105" d="M245.841 311.873v-333.206c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v333.206c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe904;" horiz-adv-x="1105" d="M1099.175 921.397v-942.73c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v942.73c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe905;" horiz-adv-x="1105" d="M530.286 515.048v-536.381c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v536.381c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe906;" horiz-adv-x="1105" d="M814.73 718.222v-739.556c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v739.556c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe907;" horiz-adv-x="1105" d="M245.841 311.873v-333.206c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v333.206c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe908;" horiz-adv-x="1105" d="M1099.175 921.397v-942.73c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v942.73c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe909;" horiz-adv-x="1105" d="M530.286 515.048v-536.381c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v536.381c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe90a;" horiz-adv-x="1105" d="M814.73 718.222v-739.556c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v739.556c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe90b;" horiz-adv-x="1105" d="M245.841 311.873v-333.206c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v333.206c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe90c;" horiz-adv-x="1105" d="M1099.175 921.397v-942.73c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v942.73c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+<glyph unicode="&#xe90d;" glyph-name="four" data-tags="Full" horiz-adv-x="1105" d="M530.286 515.048v-536.381c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v536.381c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM814.73 718.222v-739.556c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v739.556c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM245.841 311.873v-333.206c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v333.206c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571zM1099.175 921.397v-942.73c0-20.198-16.374-36.571-36.571-36.571h-170.667c-20.198 0-36.571 16.374-36.571 36.571v942.73c0 20.198 16.374 36.571 36.571 36.571h170.667c20.198 0 36.571-16.374 36.571-36.571z" />
+</font></defs></svg>

BIN
SystemAOB/functions/wifi_v1/fonts/signal-icon.ttf


BIN
SystemAOB/functions/wifi_v1/fonts/signal-icon.woff


BIN
SystemAOB/functions/wifi_v1/getNICinfo.exe


+ 71 - 0
SystemAOB/functions/wifi_v1/hardware.php

@@ -0,0 +1,71 @@
+<?php
+include '../../../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+      <title>WIFI</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+	<style>
+	.ts.items>.item>.image:not(.ts):not(.flexible) {
+		 width: 60px; !important 
+	}
+	</style>
+   </head>
+
+
+<body>
+<div class="ts fluid borderless slate">
+	<div class="ts segment" style="width:100%;">
+		<div class="ts header">
+			Hardware
+			<div class="sub header">Network Interface Card Hardware List</div>
+		</div>
+	</div>
+	<div class="ts container">
+
+
+	</div>
+</div>
+<br>
+<div class="ts container">
+	<div class="ts divided items" id="wifi">
+	</div>	
+</div>
+
+<script>
+var template = '<div class="item"><div class="image"><img style="height:64px;width:auto" src="./fonts/%image%.png"></div><div class="content"><p class="header">%interfacename%</p><div class="description">%data%</div></div></div>';
+var inWindows = <?php if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { echo "true";}else{echo "false";}?>;
+wifi();
+
+function wifi(){
+	if (inWindows){
+		$.getJSON("opr.php?opr=listnic", function(result){
+            if (result != []){
+				for (var i =0; i < result.length; i++){
+					$("#wifi").append( result[i] + '<div class="ts section divider"></div>');
+				}
+
+			}
+			$("#wifi").css("padding","20px");
+		});
+	}else{
+		$.getJSON("opr.php?opr=listnic", function(result){
+            $.each(result, function(i, field){
+				if(field[3] !== "lo:"){
+					$("#wifi").append(template.replace("%image%",field["InterfaceIcon"]).replace("%interfacename%",field["InterfaceIcon"] + " " + field["InterfaceID"]).replace("%data%","MAC Address : " + field["HardwareAddress"] + "<br>IPv4 Address : " + field["IPv4Address"] + "<br>Subnet Mask : " + field["IPv4SubNetMask"] + "<br>IPv6 Address : " + field["IPv6Address"]));
+					
+				}
+            });
+		});
+	}
+	
+}
+
+</script>
+</body>
+</html>

+ 113 - 0
SystemAOB/functions/wifi_v1/ifconfig.php

@@ -0,0 +1,113 @@
+<?php
+include '../../../auth.php';
+?>
+<?php
+//ArOZ Online network hardware detection code written for debian and windows (require exe!)
+function remove_utf8_bom($text)
+{
+    $bom = pack('H*','EFBBBF');
+    $text = preg_replace("/^$bom/", '', $text);
+    return $text;
+}
+
+if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+    exec("getNICinfo.exe");
+	sleep(1);
+	$nics = [];
+	$content = remove_utf8_bom(file_get_contents("NICinfo.txt"));
+	$data = explode(PHP_EOL,$content);
+	foreach ($data as $nicinfo){
+		array_push($nics,explode(",",$nicinfo)[0]);
+	}
+	header('Content-Type: application/json');
+	echo json_encode($nics);
+	exit();
+} else {
+	$result = [];
+    exec('sudo ifconfig',$arrayoutput);
+	foreach ($arrayoutput as $line){
+			$line = trim($line);
+			$inlinedoutput .= $line."\n";
+		}
+	
+
+$InterfaceRawInformation = explode("\n\n",$inlinedoutput);
+array_pop($InterfaceRawInformation);
+//$prased_data = preg_split("/wlan.|lo|eth./", $unprased_data,-1,PREG_SPLIT_NO_EMPTY);
+foreach ($InterfaceRawInformation as $data){
+	$data = preg_replace('/\n/', '', $data);
+	preg_match('/(wlan[0-9]+|eth[0-9]+|lo)/', $data, $tmp);
+	if(isset($tmp[1])){
+		//$exported_information["InterfaceName"] = $tmp[1];
+		$exported_information["InterfaceID"] = preg_replace('/\w+([0-9]+)/', '$1', $tmp[1]);
+		if(strpos($tmp[1], 'eth') !== false){
+			$exported_information["InterfaceIcon"] = "Ethernet";
+		}else if(strpos($tmp[1], 'wlan') !== false){
+			$exported_information["InterfaceIcon"] = "WiFi";
+		}else if(strpos($tmp[1], 'lo') !== false){
+			continue;
+		}else{
+			$exported_information["InterfaceIcon"] = "Unknown";
+		}
+	}else{
+		$exported_information["InterfaceName"] = "Unknown";
+		$exported_information["InterfaceIcon"] = "Unknown";
+	}
+	
+	preg_match('/HWaddr ([0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z])/', $data, $tmp);
+	if(isset($tmp[1])){
+		$exported_information["HardwareAddress"] = $tmp[1];
+	}else{
+		preg_match('/ether ([0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z])/', $data, $tmp);
+		if(isset($tmp[1])){
+			$exported_information["HardwareAddress"] = $tmp[1];
+		}else{
+			$exported_information["HardwareAddress"] = "Unknown";
+		}
+	}
+	
+	preg_match('/inet addr:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+	if(isset($tmp[1])){
+		$exported_information["IPv4Address"] = $tmp[1];
+	}else{
+		preg_match('/inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+		if(isset($tmp[1])){
+			$exported_information["IPv4Address"] = $tmp[1];
+		}else{
+			$exported_information["IPv4Address"] = "Unknown";
+		}
+	}
+	
+	preg_match('/Mask:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+	if(isset($tmp[1])){
+		$exported_information["IPv4SubNetMask"] = $tmp[1];
+	}else{
+		preg_match('/mask ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+		if(isset($tmp[1])){
+			$exported_information["IPv4SubNetMask"] = $tmp[1];
+		}else{
+			$exported_information["IPv4SubNetMask"] = "Unknown";
+		}
+	}
+	
+	preg_match('/inet6 addr: ([a-zA-Z0-9:]+\/[0-9]+)/', $data, $tmp);
+	if(isset($tmp[1])){
+		$exported_information["IPv6Address"] = $tmp[1];
+	}else{
+		preg_match('/inet6 ([a-zA-Z0-9:]+)/', $data, $tmp);
+		if(isset($tmp[1])){
+			$exported_information["IPv6Address"] = $tmp[1];
+		}else{
+			$exported_information["IPv6Address"] = "Unknown";
+		}
+	}
+
+	array_push($result,$exported_information);
+}
+
+
+header('Content-Type: application/json');
+echo json_encode($result);
+
+}
+?>

+ 100 - 0
SystemAOB/functions/wifi_v1/index.php

@@ -0,0 +1,100 @@
+<?php
+include '../../../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+	  
+      <title>WIFI</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+   </head>
+
+
+<body>
+<br>
+<div class="ts narrow container">
+            <div class="ts relaxed grid">
+
+                <div class="sixteen wide column">
+                    <h3 class="ts header">
+                        Wi-Fi Information
+                        <div class="sub header">Current WiFi Connection Information will be shown on this page.</div>
+                    </h3>
+                </div>
+
+                <div class="sixteen wide column">
+                    <div class="ts two cards">
+
+                        <div class="ts card">
+                            <div class="content">
+
+                                <div class="ts left aligned statistic">
+                                    <div class="value" id="CurrentConnectedWiFiNetworkName">
+                                        Detecting...
+                                    </div>
+                                    <div class="label">Wi-Fi SSID</div>
+                                </div>
+         
+                            </div>
+                            <div class="symbol">
+                                <i class="signal icon"></i>
+                            </div>
+                        </div>
+
+                        <div class="ts card">
+                            <div class="content">
+
+                                <div class="ts left aligned statistic">
+                                    <div class="value" id="CurrentInternetConnection">
+                                        Detecting...
+                                    </div>
+                                    <div class="label">Internet</div>
+                                </div>
+
+                            </div>
+                            <div class="symbol">
+                                <i class="world icon"></i>
+                            </div>
+                        </div>
+
+
+                    </div>
+
+                    <div class="ts section divider"></div>
+                    
+                </div>
+
+
+               
+        </div>
+
+<script>
+var inWindows = <?php if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN'){
+ echo "true";
+ }else{
+ echo "false";
+ }?>;
+$.get("opr.php?opr=current_connecting", function (data) {
+	if(data["ssid"] !== ""){
+		$("#CurrentConnectedWiFiNetworkName").html(data["ssid"]);
+	}else{
+		$("#CurrentConnectedWiFiNetworkName").html("No Wi-Fi network");
+	}
+});
+$.get("opr.php?opr=internet", function (data) {
+	if(data == true){
+		$("#CurrentInternetConnection").html("Connected");
+	}else{
+		$("#CurrentInternetConnection").html("Disconnected");
+	}
+});
+
+
+</script>
+</body>
+</html>

+ 42 - 0
SystemAOB/functions/wifi_v1/iwscan.php

@@ -0,0 +1,42 @@
+<?php
+include_once("../../../auth.php");
+?>
+<html>
+    <head>
+        <title>iwscan report</title>
+        <link href="../../../script/tocas/tocas.css" rel='stylesheet'>
+        <style>
+            .fullscreen{
+                width:100%;
+                height:100%;
+            }
+            body{
+                padding:10px;
+                padding-bottom:30px;
+            }
+        </style>
+    </head>
+    <body>
+		<?php
+			if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+				die('<div class="ts message">
+                        <div class="header">Not Supported OS</div>
+                        <p>This function is not supported in Windows Host.</p>
+                    </div>');
+			}
+		?>
+        <div class="fullscreen ts input">
+            <textarea class="fullscreen" readonly>
+            <?php
+                $content = trim(shell_exec("sudo iw wlan0 scan"));
+                if($content == ""){
+                    echo "Interface not found or disabled. Please make sure you have wlan0 enabled.";
+                }else{
+                    echo $content;
+                }
+            ?>
+            </textarea>
+        </div>
+       
+    </body>
+</html>

+ 145 - 0
SystemAOB/functions/wifi_v1/manage.php

@@ -0,0 +1,145 @@
+<?php
+include '../../../auth.php';
+?>
+<!DOCTYPE html>
+<html>
+   <head>
+      <meta charset="UTF-8">
+      <link rel="stylesheet" href="../../../script/tocas/tocas.css">
+      <script type='text/javascript' src="../../../script/tocas/tocas.js"></script>
+      <script src="../../../script/jquery.min.js"></script>
+      <title>WIFI</title>
+      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
+
+   </head>
+
+
+<body>
+<div class="ts fluid borderless slate">
+	<div class="ts segment" style="width:100%;">
+		<div class="ts header">
+			Wi-Fi Manager
+			<div class="sub header">A list of stored WiFi Network Configuration.</div>
+		</div>
+	</div>
+	<div class="ts container">
+
+
+	</div>
+</div>
+<br>
+<div class="ts container">
+
+<div class="ts cards" id="main_wifi">
+
+</div>
+</div>
+<div class="ts modals dimmer">
+<dialog class="ts basic modal" id="modal" style="background-color:white" close>
+    <div class="header" style="color:black" id="head_modal">
+       
+    </div>
+	<div class="content" style="color:black">
+		<p>WARNING : This action cannot be UNDONE.</p>
+		<p>Core Network configuration will be changed.</p>
+		<p></p>
+    </div>
+	<div class="actions">
+        <Button class="ts primary button">Execute</button>
+			<button class="ts negative button">Cancel</button>
+    </div>
+</dialog>
+</div>
+<div id="msgbox" class="ts bottom right snackbar">
+    <div class="content">
+        Processing...
+    </div>
+</div>
+
+
+<script>
+startup();
+
+var previouswifi;
+
+function startup(){
+//Please ADD ALL LOAD ON STARTUP SCRIPT HERE
+	get();
+}
+
+function get(){
+	var wifi = [];
+	var i = 0;
+	
+$('#main_wifi').html("");
+			$.getJSON("opr.php?opr=view_wifistorage", function(result){
+			result.forEach(function(wifi){
+					$('#main_wifi').append('<div class="ts card"><div class="content"><div class="ts medium comments"><div class="comment"><div class="avatar"><i class="big signal icon"></i></div><div class="content"><p class="author">' + wifi["ssid"] + '</p><div class="text">Priority : ' + wifi["priority"] + '</div><div class="actions"><a onclick="ask(this,\'preferred\');" ssid=' + wifi["ssid"] + '>Set as preferred</a><a onclick="ask(this,\'remove\');" ssid=' + wifi["ssid"] + '>Remove</a></div></div></div></div></div></div>');
+					console.log(wifi);
+				
+			});
+			
+
+
+    });
+}
+
+function ask(ssid,act){
+	ts('#modal').modal({
+    approve: '.primary',
+    deny: '.negative',
+    onDeny: function() {
+	if(act == "remove"){
+		msg('Action cancelled');
+	}else if(act == "preferred"){
+		msg('Action cancelled');
+	}
+    },
+    onApprove: function() {
+    if(act == "remove"){
+	remove(ssid);
+	}else if(act == "preferred"){
+	connect(ssid);
+	}
+    }
+}).modal("show");
+
+	$('#head_modal').html($(ssid).attr('ssid'));
+}
+
+function remove(ssid){
+$.get( "opr.php?opr=remove&ssid=" + $(ssid).attr("ssid") , function() {})
+  .done(function() {
+	$.ajax({url:"opr.php?opr=restart",async:false});
+	    msg("Complete");
+		get();
+  })
+  .fail(function() {
+    msg( "Failed." );
+  })
+}
+
+
+function connect(ssid){
+$.get( "opr.php?opr=top_priority&ssid=" + $(ssid).attr("ssid") , function() {})
+  .done(function() {
+	$.ajax({url:"opr.php?opr=restart",async:false});
+	    msg("Complete");
+		msg('Added Wi-Fi Network.');
+		window.location.reload();
+		get();
+  })
+  .fail(function() {
+    msg( "Failed." );
+  })
+}
+function msg(content) {
+		ts('.snackbar').snackbar({
+			content: content,
+			actionEmphasis: 'negative',
+		});
+}
+</script>
+
+</body>
+</html>

+ 365 - 0
SystemAOB/functions/wifi_v1/network.class.php

@@ -0,0 +1,365 @@
+<?php
+class wpa
+{
+    public $wpa_supplicant = [];
+	public $wpa_supplicantconf = "";
+
+	
+    function __construct() {
+		$filename = "/etc/wpa_supplicant/wpa_supplicant.conf";
+		$handle = fopen($filename, "r");
+		$input_lines = fread($handle, filesize($filename));
+		fclose($handle);
+		$this->wpa_supplicantconf = $input_lines; //this line for backup wpa_supplicant.conf to var
+		$priority = 1;
+		$primary_output = [];
+		preg_match_all("/network={[\r\n\t]([^}]*)}/m", $input_lines, $primary_output);
+		foreach($primary_output[1] as $output_line){
+			$secondary_output = [];
+			$tmp = [];
+			preg_match_all('/([^=\t\n\r]*)=["]{0,1}([^"\n]*)["]{0,1}/', $output_line, $secondary_output);
+			for($i = 0; $i <= sizeof($secondary_output[1]); $i++){ 
+				if(isset($secondary_output[1][$i]) && isset($secondary_output[2][$i])){
+					$tmp[$secondary_output[1][$i]] = $secondary_output[2][$i];
+				}
+			}
+			if(!isset($tmp["priority"])){
+				$tmp["priority"] = $priority;
+			}
+			$priority += 1;
+			array_push($this->wpa_supplicant,$tmp);
+		}
+		$this->sort_wpa();
+    }
+	
+	function sort_wpa(){
+		usort($this->wpa_supplicant, function ($a, $b) {return $a['priority'] <=> $b['priority'];});
+		$wifipriority = 1;
+		foreach($this->wpa_supplicant as &$wifiarray){
+			$wifiarray["priority"] = $wifipriority;
+			$wifipriority += 1;
+		}
+	}
+	
+	function remove($ssid){
+		$i = 0;
+		foreach($this->wpa_supplicant as $wifiarray){
+			if($wifiarray["ssid"] == $ssid){
+				unset($this->wpa_supplicant[$i]);
+				break;
+			}
+			$i += 1;
+		}
+		$this->sort_wpa();
+	}
+	
+	function add($array){
+		array_push($this->wpa_supplicant,$array);
+		$this->sort_wpa();
+	}
+	
+	function restart(){
+		exec("sudo wpa_cli reconfigure");
+	}
+	
+	function scan(){
+		$result = [];
+		$output = shell_exec('sudo iwlist wlan0 scan |grep -e ESSID -e IEEE -e "Encryption key" -e "Quality" -e "Cell" -e "Authentication Suites (1) :"');
+		$prased_data = explode("Cell",$output);
+		array_shift($prased_data);
+		foreach ($prased_data as $data){
+			preg_match_all("/.+Address: ([0-9A-Fa-f]+:[0-9A-Fa-f]+:[0-9A-Fa-f]+:[0-9A-Fa-f]+:[0-9A-Fa-f]+:[0-9A-Fa-f]+)/", $data, $tmp);
+			$split["Address"] = $tmp[1][0];
+
+			preg_match_all("/.+Quality=([0-9]+\/[0-9]+)/", $data, $tmp);
+			$split["Quality"] = $tmp[1][0];
+			if($split["Quality"] == null){
+				$split["Quality"] = "0/70";
+			}
+
+			preg_match_all("/.+Signal level=-([0-9]+ dBm)/", $data, $tmp);
+			$split["Signal_Level"] = $tmp[1][0];
+			if($split["Encryption_Key"] == null){
+				$split["Encryption_Key"] = "0 dBm";
+			}
+
+			preg_match_all("/.+Encryption key:(on|off)/", $data, $tmp);
+			$split["Encryption_Key"] = $tmp[1][0];
+			if($split["Encryption_Key"] == null){
+				$split["Encryption_Key"] = "off";
+			}
+
+			preg_match_all('/.+ESSID:"(.+)"/', $data, $tmp);
+			if(strpos($tmp[1][0],"\\x00") !== false){
+				$split["ESSID"] = "-Hidden Network-";
+			}else{
+				$split["ESSID"] = $tmp[1][0];
+			}
+			if($split["ESSID"] == null){
+				$split["ESSID"] = "-NO SSID-";
+			}
+
+			preg_match_all('/.+IE: (.+)/', $data, $tmp);
+			$split["Encrpytion_Method"] = explode("Authentication Suites (1) : ",$tmp[1][0])[0];
+			if($split["Encrpytion_Method"] == null){
+				$split["Encrpytion_Method"] = "No Encryption";
+			}
+			
+			if($split["Encryption_Key"] == "on" && $split["Encrpytion_Method"] !== null){
+				if(strpos($split["Encrpytion_Method"],"WPA2") !== false){
+					$split["Encrpytion_Method_Shortname"] = "WPA2";
+				}else if(strpos($split["Encrpytion_Method"],"802.1x") !== false){
+					$split["Encrpytion_Method_Shortname"] = "802.1x";
+				}else{
+					$split["Encrpytion_Method_Shortname"] = "No";
+				}
+			}else{
+				$split["Encrpytion_Method_Shortname"] = "No";
+			}
+			
+			
+			preg_match_all('/.+Authentication Suites \(1\) : (.+)/', $data, $tmp);
+			$split["Encryption_Suites"] = $tmp[1][0];
+			if($split["Encryption_Suites"] == null){
+				$split["Encryption_Suites"] = "No encryption";
+			}
+
+			array_push($result,$split);
+		}
+		return $result;
+	}
+	
+	function current_connecting(){
+		$result=[];
+		if(exec('iw dev wlan0 link') !== 'Not connected.'){
+			$ssid = exec("iwgetid -r");
+			$result["ssid"] = $ssid;
+			$c = exec("iwgetid -c -r");
+			$result["channel"] = $c;
+			$f = exec("iwgetid -f -r");
+			$result["frequency"] = $f;
+		}else{
+			$result["ssid"] = "";
+			$result["channel"] = "";
+			$result["frequency"] = "";	
+		}
+		return $result;
+	}
+	function view_wifistorage(){
+		return $this->wpa_supplicant;
+	}
+	
+	function top_priority($ssid){
+		$i = 0;
+		foreach($this->wpa_supplicant as $wifiarray){
+			if($wifiarray["ssid"] == $ssid){
+				$this->wpa_supplicant[$i]["priority"] = 0;
+				break;
+			}
+			$i += 1;
+		}
+		$this->sort_wpa();
+	}
+	
+	function save(){
+		$noquote = array("disabled","auth_alg","scan_ssid","key_mgmt","proto","pairwise","eap","priority");
+		$fp = fopen('/etc/wpa_supplicant/wpa_supplicant.conf', 'w');
+		fwrite($fp, 'country=DE'.PHP_EOL);
+		fwrite($fp, 'ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev'.PHP_EOL);
+		fwrite($fp, 'update_config=1'.PHP_EOL);
+		fwrite($fp, PHP_EOL);
+		
+		foreach($this->wpa_supplicant as $wifiarray){
+			fwrite($fp, 'network={'.PHP_EOL);
+			foreach($wifiarray as $key => $value){
+				if(in_array($key,$noquote)){
+					fwrite($fp, "	".$key.'='.$value.''.PHP_EOL);
+				}else{
+					fwrite($fp, "	".$key.'="'.$value.'"'.PHP_EOL);
+				}
+			}
+			fwrite($fp, '}'.PHP_EOL);
+			fwrite($fp, PHP_EOL);
+		}
+		
+		fclose($fp);
+		$this->restart_wifi();
+	}
+	
+	function restart_wifi(){
+		shell_exec('sudo ifconfig wlan0 up');
+		shell_exec('sudo ifconfig wlan1 up');
+		shell_exec('sudo /etc/init.d/networking restart');
+		$loss = shell_exec("ping -c 1 -q 255.255.255.0 -I wlan0 | grep -oP '\d+(?=% packet loss)'");
+		if($loss == "0"){
+			$failed = false;
+			$output = shell_exec('sudo journalctl -xu networking.service -o json --since="$(sudo systemctl show networking --property=ExecMainStartTimestamp --value)"');
+			$outputarr = preg_split('/\r\n|\r|\n/', $output);
+			foreach($outputarr as $msg){
+				$msgarray = json_decode($msg,true);
+				if(isset($msgarray["MESSAGE"])){
+					if(strpos($msgarray["MESSAGE"],"reason=WRONG_KEY") !== false){
+						$failed = true;
+					}
+					if(strpos($msgarray["MESSAGE"],"Failed to read or parse configuration") !== false){
+						$failed = true;
+					}
+					if(strpos($msgarray["MESSAGE"],"Failed to start Raise network interfaces") !== false){
+						$failed = true;
+					}
+				}
+			}
+			if($failed){
+				$fpwpa_supplicant_bk = fopen('/etc/wpa_supplicant/wpa_supplicant.conf', 'w');
+				fwrite($fpwpa_supplicant_bk, $this->wpa_supplicantconf);
+				fclose($fpwpa_supplicant_bk);
+				return "ERROR_RESETED";
+			}else{
+				$fpwpa_supplicant_bk = fopen('/etc/wpa_supplicant/wpa_supplicant.conf', 'w');
+				fwrite($fpwpa_supplicant_bk, $this->wpa_supplicantconf);
+				fclose($fpwpa_supplicant_bk);
+				return "ERROR_UNKNOWN_RESETED";
+				
+			}
+		}else{
+			return "SUCCESS";
+		}
+	}
+}
+
+class ifconfig
+{
+	function is_connected(){
+		$connected = fopen("http://www.google.com:80/","r");
+	  if($connected){
+		 return true;
+	  } else {
+	   return false;
+		}
+	}
+	
+	function list_nic(){
+		if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+			exec("getNICinfo.exe");
+			sleep(1);
+			$nics = [];
+			$content = remove_utf8_bom(file_get_contents("NICinfo.txt"));
+			$data = explode(PHP_EOL,$content);
+			foreach ($data as $nicinfo){
+				array_push($nics,explode(",",$nicinfo)[0]);
+			}
+			return $nics;
+		} else {
+			$result = [];
+			exec('sudo ifconfig',$arrayoutput);
+			foreach ($arrayoutput as $line){
+					$line = trim($line);
+					$inlinedoutput .= $line."\n";
+				}
+			
+
+		$InterfaceRawInformation = explode("\n\n",$inlinedoutput);
+		array_pop($InterfaceRawInformation);
+		//$prased_data = preg_split("/wlan.|lo|eth./", $unprased_data,-1,PREG_SPLIT_NO_EMPTY);
+		foreach ($InterfaceRawInformation as $data){
+			$data = preg_replace('/\n/', '', $data);
+			preg_match('/(wlan[0-9]+|eth[0-9]+|lo)/', $data, $tmp);
+			if(isset($tmp[1])){
+				//$exported_information["InterfaceName"] = $tmp[1];
+				$exported_information["InterfaceID"] = preg_replace('/\w+([0-9]+)/', '$1', $tmp[1]);
+				if(strpos($tmp[1], 'eth') !== false){
+					$exported_information["InterfaceIcon"] = "Ethernet";
+				}else if(strpos($tmp[1], 'wlan') !== false){
+					$exported_information["InterfaceIcon"] = "WiFi";
+				}else if(strpos($tmp[1], 'lo') !== false){
+					continue;
+				}else{
+					$exported_information["InterfaceIcon"] = "Unknown";
+				}
+			}else{
+				$exported_information["InterfaceName"] = "Unknown";
+				$exported_information["InterfaceIcon"] = "Unknown";
+			}
+			
+			preg_match('/HWaddr ([0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z])/', $data, $tmp);
+			if(isset($tmp[1])){
+				$exported_information["HardwareAddress"] = $tmp[1];
+			}else{
+				preg_match('/ether ([0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z]:[0-9A-Za-z][0-9A-Za-z])/', $data, $tmp);
+				if(isset($tmp[1])){
+					$exported_information["HardwareAddress"] = $tmp[1];
+				}else{
+					$exported_information["HardwareAddress"] = "Unknown";
+				}
+			}
+			
+			preg_match('/inet addr:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+			if(isset($tmp[1])){
+				$exported_information["IPv4Address"] = $tmp[1];
+			}else{
+				preg_match('/inet ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+				if(isset($tmp[1])){
+					$exported_information["IPv4Address"] = $tmp[1];
+				}else{
+					$exported_information["IPv4Address"] = "Unknown";
+				}
+			}
+			
+			preg_match('/Mask:([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+			if(isset($tmp[1])){
+				$exported_information["IPv4SubNetMask"] = $tmp[1];
+			}else{
+				preg_match('/mask ([0-9]+\.[0-9]+\.[0-9]+\.[0-9]+)/', $data, $tmp);
+				if(isset($tmp[1])){
+					$exported_information["IPv4SubNetMask"] = $tmp[1];
+				}else{
+					$exported_information["IPv4SubNetMask"] = "Unknown";
+				}
+			}
+			
+			preg_match('/inet6 addr: ([a-zA-Z0-9:]+\/[0-9]+)/', $data, $tmp);
+			if(isset($tmp[1])){
+				$exported_information["IPv6Address"] = $tmp[1];
+			}else{
+				preg_match('/inet6 ([a-zA-Z0-9:]+)/', $data, $tmp);
+				if(isset($tmp[1])){
+					$exported_information["IPv6Address"] = $tmp[1];
+				}else{
+					$exported_information["IPv6Address"] = "Unknown";
+				}
+			}
+
+			array_push($result,$exported_information);
+		}
+
+		return $result;
+		}
+	}
+}
+
+class ap
+{
+    public $settings = [];
+	
+    function __construct() {
+		$filename = "/etc/hostapd/hostapd.conf";
+		$handle = fopen($filename, "r");
+		$input_lines = fread($handle, filesize($filename));
+		fclose($handle);
+		$primary_output = [];
+		preg_match_all('/([^=\t\n\r]*)=["]{0,1}([^"\n]*)["]{0,1}/', $input_lines, $primary_output);
+		for($i = 0; $i <= sizeof($primary_output[1]); $i++){ 
+			if(isset($primary_output[1][$i]) && isset($primary_output[2][$i])){
+				$this->settings[$primary_output[1][$i]] = $primary_output[2][$i];
+			}
+		}
+    }
+	
+	function view_ap_settings(){
+		return $this->settings;
+	}
+	
+	function change_ap_settings($key,$val){
+		$this->settings[$key] = $val;
+	}
+}

+ 72 - 0
SystemAOB/functions/wifi_v1/opr.php

@@ -0,0 +1,72 @@
+<?php
+set_time_limit(600);
+ignore_user_abort(true);
+
+header('Content-Type: application/json');
+include '../../../auth.php';
+
+require_once "network.class.php";
+$wpa = new wpa();
+$ifconfig = new ifconfig();
+$ap = new ap();
+
+if(isset($_GET["opr"])){
+	if($_GET["opr"] == "current_connecting"){
+		echo json_encode($wpa->current_connecting());
+	}else if($_GET["opr"] == "internet"){
+		echo $ifconfig->is_connected(); 
+	}else if($_GET["opr"] == "scan"){
+		echo json_encode($wpa->scan()); 
+	}else if($_GET["opr"] == "view_wifistorage"){
+		echo json_encode($wpa->view_wifistorage());
+	}else if($_GET["opr"] == "listnic"){
+		echo json_encode($ifconfig->list_nic()); 
+	}else if($_GET["opr"] == "top_priority"){
+		$wpa->top_priority($_GET["ssid"]);
+		$wpa->save();
+	}else if($_GET["opr"] == "remove"){
+		$wpa->remove($_GET["ssid"]);
+		$wpa->save();
+		//print_r($wpa->view_wifistorage());
+	}else if($_GET["opr"] == "restart"){
+		$wpa->restart();
+	}else if($_GET["opr"] == "viewapsetting"){
+		echo json_encode($ap->view_ap_settings());
+	}else if($_GET["opr"] == "setap"){
+		$ap->change_ap_settings("ssid",$_POST["ssid"]);
+		$ap->change_ap_settings("wpa_passphrase",$_POST["psk"]);
+	}else if($_GET["opr"] == "addwifi"){
+		$wifiarr = [];
+		if(isset($_POST["ssid"])){
+			$wifiarr["ssid"] = $_POST["ssid"];
+		}else{
+			header('HTTP 1.1 400 Bad Request');
+		}
+		
+		if($_POST["encryption"] == "no"){
+			$wpa->add($wifiarr);
+		}else if($_POST["encryption"] == "802.1x"){
+			$wifiarr["phase1"] = "peaplabel=0";
+			$wifiarr["phase2"] = "auth=MSCHAPV2";
+			$wifiarr["password"] = $_POST["psk"];
+			$wifiarr["anonymous_identity"] = $_POST["identity"];
+			$wifiarr["identity"] = $_POST["identity"];
+			$wifiarr["eap"] = "PEAP";
+			$wifiarr["pairwise"] = "CCMP TKIP";
+			$wifiarr["proto"] = "WPA RSN";
+			$wifiarr["key_mgmt"] = "WPA-EAP";
+			$wifiarr["scan_ssid"] = "1";
+			$wifiarr["ssid"] = $_POST["ssid"];
+			$wifiarr["auth_alg"] = "OPEN";
+			$wifiarr["disabled"] = "0";
+			$wpa->add($wifiarr);
+		}else if($_POST["encryption"] == "WPA2"){
+			$wifiarr["psk"] = $_POST["psk"];
+			$wpa->add($wifiarr);
+			$wpa->save();
+		}else{
+			header('HTTP 1.1 400 Bad Request');
+		}
+	}
+}
+

+ 189 - 0
SystemAOB/functions/wifi_v1/power.php

@@ -0,0 +1,189 @@
+<?php
+include_once("../../../auth.php");
+
+//This php can be called with ajax and ask for waking up wlan0 and wlan1. However, one of them must be on at a time.
+function mv($value){
+    if (isset($_GET[$value]) && $_GET[$value] != ""){
+        return $_GET[$value];
+    }else{
+        return "";
+    }
+}
+
+function checkLinuxWlanUpDown($wlanID){
+    $result = trim(shell_exec("cat /sys/class/net/wlan" . $wlanID . "/operstate"));
+    if (trim($result) == ""){
+        return "not_found";
+    }else{
+        return $result;
+    }
+    
+    
+}
+if (strtoupper(substr(PHP_OS, 0, 3)) !== 'WIN') {
+    //Running on Linux host
+    if (mv("enable") != ""){
+        $wlan = mv("enable");
+        if ($wlan == "wlan0"){
+            //Enable wlan0 no matter it is enabled or not
+            system("sudo ifup wlan0");
+            die("DONE");
+        }else if ($wlan == "wlan1"){
+            //Enable wlan1 no matter it is enable or not
+            system("sudo ifup wlan1");
+            die("DONE");
+        }
+    }
+    
+    if (mv("disable") != ""){
+        if (mv("disable") == "wlan0"){
+            if (checkLinuxWlanUpDown(1) == "down"){
+                die("ERROR. Cannot disable wlan0 while wlan1 is also disabled.");
+            }else{
+                system("sudo ifdown wlan0");
+                die("DONE");
+            }
+        }else if (mv("disable") == "wlan1"){
+            if (checkLinuxWlanUpDown(0) == "down"){
+                die("ERROR. Cannot disable wlan1 while wlan0 is also disabled.");
+            }else{
+                system("sudo ifdown wlan1");
+                die("DONE");
+            }
+        }
+    }
+    
+    if (mv("check") != ""){
+        die(checkLinuxWlanUpDown(mv("check")));
+    }
+    
+}else{
+    //Running on a Window host
+}
+?>
+<html>
+    <head>
+        <title>WiFi Power Status</title>
+        <link href="../../../script/tocas/tocas.css" rel='stylesheet'>
+    	<script src="../../../script/jquery.min.js"></script>
+    	<style>
+        	body{
+        	    background-color:#f7f7f7;
+        	}
+    	    .selectable{
+    	        cursor:pointer;
+    	    }
+    	</style>
+    </head>
+    <body>
+        <br><br>
+        <div class="ts container">
+            <div class="ts segment">
+                <div class="ts header">
+                    WiFi Adapter Power Management
+                    <div class="sub header">Shutdown unused wireless hardware to save power</div>
+                </div>
+            </div>
+            <?php
+                if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
+                    echo '<div class="ts message">
+                        <div class="header">Not Supported OS</div>
+                        <p>This function is not supported in Windows Host.</p>
+                    </div>';
+                    exit(0);
+                }
+            ?>
+            <div id="errormsg" class="ts primary segment" style="display:none;">
+                <p>Error Message: </p>
+            </div>
+            <div class="ts inverted segment">
+                <p id="wlan0">wlan0: Loading...</p>
+            </div>
+            <div>Action: <a onClick="onwlan(0);" class="selectable">wlan0-up</a> / <a onClick="offwlan(0);" class="selectable">wlan0-down</a></div>
+            <div class="ts inverted segment">
+                <p id="wlan1">wlan1: Loading...</p>
+            </div>
+            <div>Action: <a onClick="onwlan(1);" class="selectable">wlan1-up</a> / <a onClick="offwlan(1);" class="selectable">wlan1-down</a></div>
+            <details class="ts accordion">
+                <summary>
+                    <i class="dropdown icon"></i> What is wlan0 and wlan1?
+                </summary>
+                <div class="content">
+                    <p>ArOZ Online System that runs on Raspberry Pi Zero W / Pi 3B+ or above require at least two WiFi Adapter to work.
+                    But in most of the cases, even two wireless hardware is built in, most people only use one of them at the same time.
+                    Hence, switching on of them off will save more power and extend the battery life of the device.</p>
+                    <mark>By default, wlan0 is WiFi Client and wlan1 is Acess Point</mark>
+                    <p>If you are accessing the ArOZ Online System via Local IP Scanner (e.g. lanips.imuslab.com or ArOZ Portable Scanner Apps), do not shutdown wlan0<br>
+                    If you are accessing the ArOZ Online System via directly connect to the devices' WiFi Hotspot, do not turn of wlan1.</p>
+                    <p>If you don't know anything about WiFi or AP, just leave both of them on.</p>
+                </div>
+            </details>
+        </div>
+        <script>
+            $(document).ready(function(){
+               updateBothwlanStatus();
+            });
+            
+            function onwlan(id){
+                if (id == 0){
+                     $.get("power.php?enable=wlan0",function(data){
+                         updateBothwlanStatus();
+                     });
+                }else if (id == 1){
+                    $.get("power.php?enable=wlan1",function(data){
+                         updateBothwlanStatus();
+                     });
+                }
+                
+            }
+            function offwlan(id){
+                if (id == 0){
+                    $.get("power.php?disable=wlan0",function(data){
+                        if (data.includes("ERROR")){
+                            $("#errormsg").find("p").text(data);
+                            $("#errormsg").fadeIn().delay(5000).fadeOut();
+                        }else{
+                            updateBothwlanStatus();
+                        }
+                         
+                    });
+                }else if (id == 1){
+                    $.get("power.php?disable=wlan1",function(data){
+                        if (data.includes("ERROR")){
+                            $("#errormsg").find("p").text(data);
+                            $("#errormsg").fadeIn().delay(5000).fadeOut();
+                        }else{
+                            updateBothwlanStatus();
+                        }
+                         
+                    });
+                }
+                
+            }
+            
+            function updateBothwlanStatus(){
+                $("#wlan0").parent().removeClass("positive").removeClass("negative");
+                $("#wlan1").parent().removeClass("positive").removeClass("negative");
+                $.get("power.php?check=0",function(data){
+                    
+                    if (data == "up"){
+                        $("#wlan0").parent().addClass("positive");
+                        $("#wlan0").html("<i class='checkmark icon'></i>wlan0: " + data);
+                    }else if (data == "down"){
+                        $("#wlan0").parent().addClass("negative");
+                        $("#wlan0").html("<i class='remove icon'></i>wlan0: " + data);
+                    }
+                });
+                $.get("power.php?check=1",function(data){
+                    if (data == "up"){
+                        $("#wlan1").html("<i class='checkmark icon'></i>wlan1: " + data);
+                        $("#wlan1").parent().addClass("positive");
+                    }else if (data == "down"){
+                        $("#wlan1").html("<i class='remove icon'></i>wlan1: " + data);
+                        $("#wlan1").parent().addClass("negative");
+                    }
+                });
+            }
+        </script>
+    </body>
+</html>

+ 41 - 0
SystemAOB/functions/wifi_v1/style.css

@@ -0,0 +1,41 @@
+@font-face {
+  font-family: 'icomoon';
+  src:  url('fonts/icomoon.eot?hflvwz');
+  src:  url('fonts/icomoon.eot?hflvwz#iefix') format('embedded-opentype'),
+    url('fonts/icomoon.ttf?hflvwz') format('truetype'),
+    url('fonts/icomoon.woff?hflvwz') format('woff'),
+    url('fonts/icomoon.svg?hflvwz#icomoon') format('svg');
+  font-weight: normal;
+  font-style: normal;
+}
+
+[class^="icon-"], [class*=" icon-"] {
+  /* use !important to prevent issues with browser extensions that change fonts */
+  font-family: 'icomoon' !important;
+  speak: none;
+  font-style: normal;
+  font-weight: normal;
+  font-variant: normal;
+  text-transform: none;
+  line-height: 1;
+
+  /* Better Font Rendering =========== */
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+.icon-Full:before {
+  content: "\e900";
+}
+.icon-0:before {
+  content: "\e901";
+}
+.icon-1:before {
+  content: "\e902";
+}
+.icon-2:before {
+  content: "\e903";
+}
+.icon-3:before {
+  content: "\e904";
+}

+ 27 - 0
SystemAOB/functions/wifi_v1/wpa_supplicant.conf

@@ -0,0 +1,27 @@
+country=DE
+ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
+update_config=1
+
+network={
+	disabled=0
+	auth_alg=OPEN
+	ssid="eduroam"
+	scan_ssid=1
+	key_mgmt=WPA-EAP
+	proto=WPA RSN
+	pairwise=CCMP TKIP
+	eap=PEAP
+	identity="20093247@learner.hkuspace.hku.hk"
+	anonymous_identity="20093247@learner.hkuspace.hku.hk"
+	password="123456"
+	phase1="peaplabel=0"
+	phase2="auth=MSCHAPV2"
+	priority=1
+}
+
+network={
+	ssid="CISCO_kickyrass"
+	psk="796130954"
+	priority=2
+}
+