示例#1
0
文件: index.php 项目: jhbsz/ossimTest
<!-- <h1 align="center"> <?php 
echo gettext("Directive Editor");
?>
 </h1> -->
<?php 
if ($directive_id == '') {
    $XML_FILE = '/etc/ossim/server/directives.xml';
    //unset($_SESSION['XML_FILE']);
} elseif ($directive_xml != "") {
    $XML_FILE = '/etc/ossim/server/' . $directive_xml;
    //unset($_SESSION['XML_FILE']);
} elseif ($_SESSION['XML_FILE'] != "") {
    $XML_FILE = $_SESSION['XML_FILE'];
} else {
    $XML_FILE = get_directive_file($directive_id);
}
if ($XML_FILE != '/etc/ossim/server/directives.xml') {
    init_file($XML_FILE);
}
//$_SESSION['XML_FILE']=$XML_FILE;
/* create dom object from a XML file */
if (!($dom = domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) {
    echo "<center><span style='color:red'>";
    if ($XML_FILE != "") {
        echo _("Error while parsing the document\nMake sure that") . " {$XML_FILE} " . _("begins with xml tag!\n");
    } else {
        echo _("The directive doesn't exist");
    }
    echo "</span></center>";
    exit;
示例#2
0
function is_free($directive_id, $XML_FILE = "")
{
    if ($XML_FILE == "") {
        $XML_FILE = get_directive_file($directive_id);
    }
    //if (!file_exists($XML_FILE)) return "false";
    init_file($XML_FILE);
    $dom = domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES);
    $count = 1;
    $free = "true";
    foreach ($dom->get_elements_by_tagname('directive') as $directive) {
        $id = $directive->get_attribute('id');
        $name = $directive->get_attribute('name');
        $count++;
        if (strcmp($id, $directive_id) == 0) {
            $free = "false";
        }
    }
    release_file($XML_FILE);
    return $free;
}
示例#3
0
文件: utils.php 项目: jhbsz/ossimTest
            $parent->remove_child($old_node);
            $directives->append_child($node);
        } else {
            $old_node->replace_node($node);
        }
        $dom->dump_file($XML_FILE);
        $dom2->dump_file($OLD_XML_FILE);
        if ($OLD_XML_FILE != $XML_FILE) {
            release_file($OLD_XML_FILE);
        }
    }
    release_file($XML_FILE);
    echo "<html><body onload=\"window.open('../index.php?directive=" . $new_directive->id . "&level=1','main')\"></body></html>";
} elseif ($query == "delete_directive") {
    $dir_id = $_GET['id'];
    $file = get_directive_file($dir_id);
    $dom = open_file($file);
    $tab_directive = $dom->get_elements_by_tagname('directive');
    foreach ($tab_directive as $lign) {
        if ($lign->get_attribute('id') == $dir_id) {
            $directive = $lign;
        }
    }
    $parent = $directive->parent_node();
    $parent->remove_child($directive);
    $dom->dump_file($file);
    release_file($file);
    echo "<html><body onload=\"window.open('../index.php','main')\"></body></html>";
} elseif ($query == "add_directive") {
    $cat_id = $_GET['id'];
    $category = get_category_by_id($cat_id);