function ping_group($gpid) { if (!is_numeric($gpid)) { return; } if ($gpid == 0) { return; } $q = new mysql_meta(); $sql = "SELECT uuid FROM metagroups_link WHERE gpid={$gpid}"; $results = $q->QUERY_SQL($sql); if (!$this->ok) { meta_admin_mysql(1, "MySQL error", $q->mysql_error, __FILE__, __LINE__); echo $q->mysql_error . "\n{$sql}\n"; return; } while ($ligne = mysql_fetch_assoc($results)) { $uuid = $ligne["uuid"]; ping_host($uuid); } }
break; case 'query_reload': host_reload_query(); header('Location: host.php?action=edit&id=' . $_REQUEST['host_id'] . '#dqtop'); break; case 'query_verbose': host_reload_query(); header('Location: host.php?action=edit&id=' . $_REQUEST['host_id'] . '&display_dq_details=true#dqdbg'); break; case 'edit': top_header(); host_edit(); bottom_footer(); break; case 'ping_host': ping_host(); break; default: top_header(); host(); bottom_footer(); break; } /* -------------------------- Global Form Functions -------------------------- */ function add_tree_names_to_actions_array() { global $device_actions; /* add a list of tree names to the actions dropdown */ $trees = db_fetch_assoc('SELECT id, name FROM graph_tree ORDER BY name');
function scan_categories($aspid = false) { $unix = new unix(); if ($aspid) { $pidfile = "/etc/artica-postfix/pids/" . basename(__FILE__) . "." . __FUNCTION__ . ".pid"; $pid = @file_get_contents($pidfile); if ($unix->process_exists($pid)) { die; } @file_put_contents($pidfile, getmypid()); } $sock = new sockets(); $ArticaMetaStorage = $sock->GET_INFO("ArticaMetaStorage"); if ($ArticaMetaStorage == null) { $ArticaMetaStorage = "/home/artica-meta"; } $q = new mysql_meta(); $sql = "SELECT webfiltering_categories_items.pattern, metagroups_link.uuid, \n\twebfiltering_categories_link.category FROM metagroups_link,webfiltering_categories_link,\n\twebfiltering_categories_items WHERE webfiltering_categories_link.gpid=metagroups_link.gpid \n\tAND webfiltering_categories_items.category=webfiltering_categories_link.category"; $results = $q->QUERY_SQL($sql); if (mysql_num_rows($results) == 0) { scan_categories_clean(); return; } while ($ligne = mysql_fetch_assoc($results)) { $uuid = $ligne["uuid"]; $category = $ligne["category"]; $ARRAY[$uuid][$category]["SITES"][] = $ligne["pattern"]; } $sql = "SELECT webfiltering_categories_urls.pattern, metagroups_link.uuid,\n\twebfiltering_categories_link.category FROM metagroups_link,webfiltering_categories_link,\n\twebfiltering_categories_urls WHERE webfiltering_categories_link.gpid=metagroups_link.gpid\n\tAND webfiltering_categories_urls.category=webfiltering_categories_link.category"; $results = $q->QUERY_SQL($sql); while ($ligne = mysql_fetch_assoc($results)) { $uuid = $ligne["uuid"]; $category = $ligne["category"]; $ARRAY[$uuid][$category]["URLS"][] = $ligne["pattern"]; } $MAIN_UUID = array(); while (list($uuid, $FINAL) = each($ARRAY)) { @mkdir("{$ArticaMetaStorage}/{$uuid}"); $SourceFile = "{$ArticaMetaStorage}/{$uuid}/PERSONAL_CATEGORIES"; $destfile = "{$ArticaMetaStorage}/{$uuid}/PERSONAL_CATEGORIES.gz"; $MAIN_UUID[$uuid] = true; if ($GLOBALS["VERBOSE"]) { echo "Saving: {$destfile}\n"; } @file_put_contents($SourceFile, serialize($FINAL)); if (!$unix->compress($SourceFile, $destfile)) { @unlink($SourceFile); @unlink($destfile); continue; } ping_host($uuid); @unlink($SourceFile); } if ($aspid) { @unlink($pidfile); } scan_categories_clean($MAIN_UUID); }