Iptables.php
authorAlan Knowles <alan@roojs.com>
Mon, 1 Apr 2013 03:04:15 +0000 (11:04 +0800)
committerAlan Knowles <alan@roojs.com>
Mon, 1 Apr 2013 03:04:15 +0000 (11:04 +0800)
Iptables.php

index d6f1bf1..b2e73ce 100644 (file)
@@ -156,12 +156,16 @@ class Pman_Admin_Iptables extends Pman {
     function readChain($chain)
     {
         
-        require_once 'System.php';
-        
-        $iptables = System::which('iptables', '/sbin/iptables');
+        static $iptables;
         
-         if (!$iptables || !file_exists($iptables)) {
-            $this->jerr("iptables could not be found.");
+        if (!$iptables) {
+            require_once 'System.php';
+            
+            $iptables = System::which('iptables', '/sbin/iptables');
+            
+            if (!$iptables || !file_exists($iptables)) {
+                $this->jerr("iptables could not be found.");
+            }
         }
         // this should have been set up already..
         // in the base firewall code.
@@ -223,12 +227,16 @@ class Pman_Admin_Iptables extends Pman {
     
     function updateTables()
     {
-        require_once 'System.php';
-        
-        $iptables = System::which('iptables', '/sbin/iptables');
+        static $iptables;
         
-         if (!$iptables || !file_exists($iptables)) {
-            $this->jerr("iptables could not be found.");
+        if (!$iptables) {
+            require_once 'System.php';
+            
+            $iptables = System::which('iptables', '/sbin/iptables');
+            
+            if (!$iptables || !file_exists($iptables)) {
+                $this->jerr("iptables could not be found.");
+            }
         }
         // this should have been set up already..
         // in the base firewall code.