function inject() { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $unix = new unix(); if (!$GLOBALS["FULL"]) { $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid, __FILE__)) { writelogsBLKS("Warning: Already running pid {$pid}", __FUNCTION__, __FILE__, __LINE__); return; } } @file_put_contents($pidfile, getmypid()); $working_dir = $GLOBALS["working_directory"]; $unix = new unix(); $sql = "SELECT * FROM updates_categories WHERE finish=0 and progress>0 AND filesize>0 ORDER BY categories"; $q = new mysql(); $results = $q->QUERY_SQL($sql, "artica_backup"); if (!$q->ok) { echo "Fatal error {$sql}\n"; ufdbguard_admin_events("Fatal: mysql database error {$q->mysql_error} while retreive update list", __FUNCTION__, __FILE__, __LINE__, "update"); return; } $num = mysql_num_rows($results); echo "{$num} files to check\n"; while ($ligne = @mysql_fetch_array($results, MYSQL_ASSOC)) { $filename = $ligne["filename"]; $targetfile = $working_dir . "/" . $filename; $targetfileUncompress = $working_dir . "/" . $filename . ".ext"; UpdateCategories($filename, 30, "{uncompress}", 0); if (!extractGZ($targetfile, $targetfileUncompress)) { ufdbguard_admin_events("Fatal: unable to extract {$targetfile}", __FUNCTION__, __FILE__, __LINE__, "update"); $unix->send_email_events("Proxy:[BlacklistsDB] Fatal: unable to extract {$targetfile}", "", "proxy"); UpdateCategories($filename, 30, "{failed_uncompress}", 0); continue; } inject_sql($filename, $targetfileUncompress); //return; } CategoriesCountCache(); }
function inject_defs($r, $d) { if (!$d) { return $r; } if ($_POST['sql']) { return inject_sql($r, $d); } if ($_POST['mono']) { return inject_mono($r, $d); } $rb = explode('$', $d); echo $_POST['save']; foreach ($rb as $k => $v) { $key = embed_detect($v, '[', ']', ''); $key = str_replace(array("'", '"'), '', $key); $value = embed_detect($v, 'array(', ');', ''); $value = str_replace(array("'", '"'), '', $value); if (substr($value, 0, 1) == "#") { $value = '&' . $value; } if (strpos($value, ",") !== false) { $rc = explode(',', $value); } else { $rc = array($value); } if ($key && $value) { $rd[$key] = $rc; } } if ($_POST['replace']) { $r = $rd; } else { $r += $rd; } return $r; }