support for simple fixed translation table
This commit is contained in:
parent
54c7f36f60
commit
3b85a62d45
|
@ -1,6 +1,6 @@
|
|||
<?php
|
||||
|
||||
define("OUTPUT_SERVER_DIRECTORY", "/www/pamela/uploads");
|
||||
define("OUTPUT_SERVER_DIRECTORY", "/home/sandbender/www/pamela-trans/uploads");
|
||||
define("MACFILE_TTL", "3600");
|
||||
|
||||
|
||||
|
|
10
js/input.php
10
js/input.php
|
@ -1,10 +0,0 @@
|
|||
<?php header("Content-type: application/pdf"); header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); header("Cache-Control: no-cache"); header("Pragma: no-cache"); ?> [ "00:01:e8:04:99:be",
|
||||
"00:04:23:ac:54:f9",
|
||||
"00:0a:e4:3b:fa:33",
|
||||
"00:11:85:6a:1f:ec",
|
||||
"00:13:77:bd:ec:2b",
|
||||
"00:16:d3:82:ab:ca",
|
||||
"00:1a:4b:7a:eb:14",
|
||||
"00:21:70:8a:87:68",
|
||||
"00:21:70:b0:c5:49",
|
||||
"08:8c:88:1b:07:31", ]
|
6
lib/trans.php
Normal file
6
lib/trans.php
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?php
|
||||
$mac_translation_table=array(
|
||||
'00:30:05:25:b2:f5' => 'appelblauwzeegroen', //192.168.42.11 appelblauwzeegroen FreeBSD 8.0 00:30:05:25:B2:F5 man-ip: 172.16.1.11
|
||||
'00:08:02:c8:56:1f' => 'gitorious', //192.168.42.44 gitorious Ubuntu 8.04 00:08:02:C8:56:1F man-ip: 172.16.1.44
|
||||
'00:0f:66:c8:ac:db' => 'openwrt' //192.168.42.13 openwrt Openwrt 00:0F:66:C8:AC:DB man-ip: 172.16.1.1
|
||||
);
|
15
macs.php
15
macs.php
|
@ -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();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user