index.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. if (cfr('MACVEN')) {
  3. $altercfg = $ubillingConfig->getAlter();
  4. if ($altercfg['MACVEN_ENABLED']) {
  5. if (ubRouting::checkGet('mac')) {
  6. $mac = ubRouting::get('mac');
  7. if (@$altercfg['MACVEN_CACHE']) {
  8. $cache = new UbillingCache();
  9. $cacheTime = 2592000; //something about month
  10. $vendorCache = $cache->get('MACVENDB', $cacheTime);
  11. if (!empty($vendorCache) and is_array($vendorCache)) {
  12. if (isset($vendorCache[$mac])) {
  13. //from cache
  14. $vendor = $vendorCache[$mac];
  15. } else {
  16. //cache update
  17. $vendor = zb_MacVendorLookup($mac);
  18. $vendorCache[$mac] = $vendor;
  19. $cache->set('MACVENDB', $vendorCache, $cacheTime);
  20. }
  21. } else {
  22. //empty cache
  23. $vendorCache = array();
  24. $vendor = zb_MacVendorLookup($mac);
  25. $vendorCache[$mac] = $vendor;
  26. $cache->set('MACVENDB', $vendorCache, $cacheTime);
  27. }
  28. } else {
  29. $vendor = zb_MacVendorLookup($mac);
  30. }
  31. if (!ubRouting::checkGet('raw')) {
  32. $vendor = wf_tag('h3') . wf_tag('center') . $vendor . wf_tag('center', true) . wf_tag('h3', true);
  33. if (ubRouting::checkGet('modalpopup')) {
  34. $vendor = wf_modalOpened(__('Device vendor'), $vendor, '400', '200');
  35. }
  36. }
  37. print($vendor);
  38. }
  39. } else {
  40. print(__('This module is disabled'));
  41. }
  42. } else {
  43. print(__('Access denied'));
  44. }
  45. die();