function ParseKav4ProxyLogs() { $users = new usersMenus(); if (!$users->KAV4PROXY_INSTALLED) { die; } $unix = new unix(); $pid = $unix->PIDOF("/opt/kaspersky/kav4proxy/bin/kav4proxy-keepup2date"); if ($unix->process_exists($pid)) { return; } $dir = "/var/log/artica-postfix/kaspersky/kav4proxy"; if (!is_dir($dir)) { return null; } $unix = new unix(); $files = $unix->DirFiles($dir); $lic = false; while (list($num, $file) = each($files)) { if (!preg_match("#([0-9\\-]+)_([0-9]+)-([0-9]+)-([0-9]+)#", $file, $re)) { continue; } $date = "{$re[1]} {$re[2]}:{$re[3]}:{$re[4]}"; $NumberofKas3FilesUpdated = NumberofKavFilesUpdated("{$dir}/{$file}"); if ($NumberofKas3FilesUpdated < 0) { $subject = "Kaspersky Antivirus Proxy: update failed"; send_email_events($subject, @file_get_contents("{$dir}/{$file}"), "KASPERSKY_UPDATES", $date); ParseKav4ProxyLogsMysql($date, $subject, "{$dir}/{$file}"); $lic = true; continue; } if ($NumberofKas3FilesUpdated > 0) { $subject = "Kaspersky Antivirus Proxy: {$NumberofKas3FilesUpdated} new viruses in databases"; ParseKav4ProxyLogsMysql($date, $subject, "{$dir}/{$file}"); send_email_events($subject, @file_get_contents("{$dir}/{$file}"), "KASPERSKY_UPDATES", $date); $lic = true; continue; } if (AllAreUp2date("{$dir}/{$file}")) { ParseKav4ProxyLogsMysql($date, "All files are up-to-date", "{$dir}/{$file}"); $lic = true; continue; } if (completed("{$dir}/{$file}")) { ParseKav4ProxyLogsMysql($date, "Update completed successfully", "{$dir}/{$file}"); $lic = true; continue; } $size = @filesize("{$dir}/{$file}"); ParseKav4ProxyLogsMysql($date, "Updates launched...({$size} bytes)", "{$dir}/{$file}"); } if ($lic) { $php5 = $unix->LOCATE_PHP5_BIN(); shell_exec("{$php5} /usr/share/artica-postfix/exec.kav4proxy.php --license"); } }
* Date: 30/12/14 * Time: 1:36 PM * To change this template use File | Settings | File Templates. */ include_once "conn.php"; $queryAppend = ''; if (isset($_REQUEST['p']) && $_REQUEST['p'] != '') { $queryAppend = " AND cp = '" . $_REQUEST['p'] . "'"; } if (isset($_REQUEST['res']) && $_REQUEST['res'] != '') { $res = $_REQUEST['res']; } if ($res == 'INPROCESS') { echo in_process($_Link, $queryAppend); } elseif ($res == 'COMPLETED') { echo completed($_Link, $queryAppend); } elseif ($res == 'FAILURE') { echo failure($_Link, $queryAppend); } elseif ($res == "CLEAR") { failureClear($_Link, $_REQUEST['p'], $_REQUEST['id']); } function failureClear($_Link, $p, $id) { if ($id > 0 && !empty($id)) { $updateQuery = "UPDATE jobs SET job_status = 999 WHERE job_id = " . $id; $res = mysqli_query($_Link, $updateQuery); $queryAppend = ''; if (isset($p) && $p != '') { $queryAppend = " AND cp = '" . $p . "'"; } echo failure($_Link, $queryAppend);