function detectCards() { $unix = new unix(); $detect = false; $sock = new sockets(); $lspci = $unix->find_program("lspci"); $iwlist = $unix->find_program("iwlist"); if ($iwlist == null) { if ($GLOBALS["VERBOSE"]) { echo "Unable to stat iwlist\n"; } $sock->SET_INFO("WifiCardOk", 0); exit; } exec("{$lspci} -mm", $results); while (list($num, $ligne) = each($results)) { if (preg_match('#[0-9\\:\\.]+\\s+".+?"\\s+".+?"\\s+"(.+?)"#', $ligne, $re)) { if (SupportedCards($re[1])) { $detect = true; } } } if ($detect) { echo "Starting......: WIFI Network Card detected\n"; $sock = new sockets(); $sock->SET_INFO("WifiCardOk", 1); exit; } $sock->SET_INFO("WifiCardOk", 0); }
function detectCards() { $unix = new unix(); if ($unix->file_time_get(basename(__FILE__)) < 5) { return; } @mkdir("/etc/artica-postfix/pids", 0755, true); $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . ".pid"; $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid, basename(__FILE__))) { echo "detectCards: [INFO] Already running...\n"; die; } @file_put_contents($pidfile, getmypid()); $unix->file_time_set(basename(__FILE__)); $detect = false; $sock = new sockets(); $lspci = $unix->find_program("lspci"); $iwlist = $unix->find_program("iwlist"); if ($iwlist == null) { if ($GLOBALS["VERBOSE"]) { echo "Unable to stat iwlist\n"; } $sock->SET_INFO("WifiCardOk", 0); exit; } exec("{$lspci} -mm", $results); while (list($num, $ligne) = each($results)) { if (preg_match('#[0-9\\:\\.]+\\s+".+?"\\s+".+?"\\s+"(.+?)"#', $ligne, $re)) { if (SupportedCards($re[1])) { $detect = true; } } } if ($detect) { echo "Starting......: " . date("H:i:s") . " WIFI Network Card detected\n"; $sock = new sockets(); $sock->SET_INFO("WifiCardOk", 1); exit; } $sock->SET_INFO("WifiCardOk", 0); }