$plugin_sid_list = $_GET['plugin_sid_list']; $plugin_sid_array = split(',', $plugin_sid_list); $req = 'AND ('; foreach ($plugin_sid_array as $sid) { $req .= ($req == 'AND (' ? '' : ' OR ') . "sid = {$sid}"; } $req .= ')'; $plugin_list = getPluginSidList($plugin_id, $req); if (is_array($plugin_list) && count($plugin_list) == count($plugin_sid_array)) { echo "true"; } else { echo "false"; } } elseif ($query == 'get_category_id_by_directive_id') { $directive_id = $_GET['directive_id']; echo get_category_id_by_directive_id($directive_id); } elseif ($query == 'get_new_directive_id') { $category_id = $_GET['category_id']; echo new_directive_id($category_id); } elseif ($query == "restart") { exec('sudo /etc/init.d/ossim-server restart'); } elseif ($query == 'is_free') { $directive = $_GET['directive']; echo is_free($directive); } elseif ($query == 'check_mini_maxi') { $current_category_id = $_GET['current_category_id']; $mini = $_GET['mini']; $maxi = $_GET['maxi']; echo check_mini_maxi($current_category_id, $mini, $maxi); } elseif ($query == 'file_exists') { $xml_file = $_GET['xml_file'];
$node->set_attribute('name', "New directive"); $node->set_attribute('priority', "0"); $directive = new Directive($id, "New directive", "0", $null, $node); $_SESSION['directive'] = serialize($directive); release_file($XML_FILE); echo "<html><body onload=\"window.open('../right.php?add=1&directive=" . $id . "&level=1&action=edit_dir&id=" . $id . "&onlydir={$onlydir}&xml_file=" . $category->xml_file . "','right')\"></body></html>"; } elseif ($query == "copy_directive") { $dir_id = $_GET['id']; if ($_GET['directive_xml'] != "") { $file = "/etc/ossim/server/" . $_GET['directive_xml']; } elseif ($_SESSION['XML_FILE'] != "") { $file = $_SESSION['XML_FILE']; } else { $file = get_directive_file($dir_id); } $id_category = get_category_id_by_directive_id($dir_id); $dom = open_file($file); $directive = getDirectiveFromXML($dom, $dir_id); if ($directive->directive == "") { header("Location: ../viewer/index.php?directive={$dir_id}"); } $mini = $_GET['mini']; $new_id = new_directive_id_by_directive_file($file, $mini); //$new_id = new_directive_id($id_category); $new_directive = $dom->create_element('directive'); $new_directive->set_attribute('id', $new_id); $new_directive->set_attribute('name', "Copy of " . $directive->name); $new_directive->set_attribute('priority', $directive->priority); $tab_rules = $directive->rules; for ($ind = 1; $ind <= count($tab_rules); $ind++) { $rule = $tab_rules[$ind];