support for simple fixed translation table

This commit is contained in:
sandb
2010-02-12 23:24:19 +01:00
parent 54c7f36f60
commit 3b85a62d45
4 changed files with 22 additions and 11 deletions

View File

@@ -25,9 +25,19 @@ header("Pragma: no-cache");
require_once("config.php");
require_once("lib/util.php");
require_once("lib/trans.php");
// [ "00:01:e8:04:99:be", "00:05:4e:40:1e:97", "00:0c:f1:16:10:ba", "00:0c:f1:1d:dc:70", "00:0e:35:96:c7:ff", "00:11:85:6a:1f:ec", ]
function translator($mac) {
global $mac_translation_table;
if (array_key_exists($mac, $mac_translation_table))
return $mac_translation_table[$mac];
return $mac;
}
class Macs {
private $macs;
@@ -62,6 +72,10 @@ class Macs {
private function cleanUp() {
$this->macs = array_unique($this->macs);
}
private function translate() {
$this->macs = array_map("translator", $this->macs);
}
private function createJson() {
if (count($this->macs) < 1) {
@@ -77,6 +91,7 @@ class Macs {
public function run() {
$this->readFiles(OUTPUT_SERVER_DIRECTORY);
$this->cleanUp();
$this->translate();
$this->createJson();
}