Пример #1
0
function printxmlRequest($logname)
{
    global $HTTP_RAW_POST_DATA, $xmlDoc, $xmlResponse, $xmlMessage, $result, $con;
    $fp = fopen("./Log/" . $logname . "Request.xml", "w+");
    fwrite($fp, $HTTP_RAW_POST_DATA);
    fclose($fp);
    $xmlDoc = domxml_open_file("./Log/" . $logname . "Request.xml");
}
Пример #2
0
function parseXMLStr()
{
    global $HTTP_RAW_POST_DATA, $xmlResponse, $xmlMessage, $result, $con;
    if (dbConnect() == FALSE) {
        $xmlMessage .= "<status>Fail</status>";
        $xmlMessage .= "<info>Could not connect to the database</info>";
        return FALSE;
    }
    $fp = fopen("./Log/codes.xml", "w+");
    fwrite($fp, $HTTP_RAW_POST_DATA);
    fclose($fp);
    $xmldoc = domxml_open_file("./Log/codes.xml");
    $noderoot = $xmldoc->document_element();
    if ($noderoot->tagname = "insert") {
        $childnodes = $noderoot->child_nodes();
        foreach ($childnodes as $value) {
            if ($value->tagname == "area") {
                $area = $value->get_content();
            } else {
                if ($value->tagname == "assoc_code") {
                    $assoc_code = $value->get_content();
                } else {
                    if ($value->tagname == "paper_code") {
                        $paper_code = $value->get_content();
                    } else {
                        if ($value->tagname == "assoc_desc") {
                            $assoc_desc = $value->get_content();
                        } else {
                            if ($value->tagname == "paper_desc") {
                                $paper_desc = $value->get_content();
                            } else {
                                if ($value->tagname == "location") {
                                    $location = $value->get_content();
                                }
                            }
                        }
                    }
                }
            }
        }
        if (dbOperations($area, $assoc_code, $paper_code, $assoc_desc, $paper_desc, $location) == FALSE) {
            $xmlMessage .= "<status>Fail</status>";
            $xmlMessage .= "<info>Registration failed, try registering again</info>";
            $result = FALSE;
        }
    } else {
        $xmlMessage .= "<status>Fail</status>";
        $xmlMessage .= "<info>Wrong XMLRequest Format</info>";
        $result = FALSE;
    }
    dbClose();
    return $result;
}
Пример #3
0
 /**
  * Unmarshall a XML diagram file into an object structure (DiaDiagram)
  *
  * @param   string filename The diagram filename (.dia)
  * @return  org.dia.DiaDiagram
  */
 public static function unmarshal($diagram)
 {
     // suck in XML document
     if (!($dom = domxml_open_file($diagram, DOMXML_LOAD_PARSING, $error))) {
         throw new XMLFormatException(xp::stringOf($error));
     }
     // initialize XPath
     $XPath = new XPath($dom);
     // TODO: if the URI is wrong, unmarshalling won't work!
     $XPath->registerNamespace('dia', 'http://www.lysator.liu.se/~alla/dia/');
     // new (unused): $XPath->registerNamespace('dia', 'http://www.gnome.org/projects/dia/');
     // go
     $Dia = DiaUnmarshaller::recurse($XPath, $dom->document_element(), 'org.dia.DiaDiagram');
     Console::writeLine('DiaUnmarshaller used up ' . round(memory_get_usage() / 1024, 2) . ' Kb of memory.');
     return $Dia;
 }
Пример #4
0
 function run($srcfile)
 {
     $dom = domxml_open_file($srcfile);
     $rawdata = $dom->dump_mem(true);
     $rawdata = str_replace("<?xml version=\"1.0\" encoding=\"UTF-8\"?>", "", $rawdata);
     /*
     $this->addSeperator("Rawdata");
     echo "<br>".$rawdata."<br>";
     */
     $this->addSeperator("Content");
     $rawdata = "[dojocontent]" . $rawdata . "[/dojocontent]";
     $this->dl_dojoLoader->addcontenttags = false;
     $content = $this->dl_dojoLoader->addContent($rawdata);
     echo $content;
     $this->addSeperator("Ende");
 }
 function load($in_CSSML, $in_type = 'string')
 {
     if (parent::isError($load = parent::load())) {
         return $load;
     }
     // If the CSSML data is already a DOM object (can tell by checking for root)
     if ($in_type == 'object' && get_class($in_CSSML) == 'DomDocument') {
         $this->CSSMLDoc = $in_CSSML;
     } elseif ($in_type == 'file' && @file_exists($in_CSSML)) {
         $this->CSSMLDoc = domxml_open_file($in_CSSML);
     } elseif ($in_type == 'string' && is_string($in_CSSML)) {
         $this->CSSMLDoc = domxml_open_mem($in_CSSML);
     } else {
         return PEAR::raiseError(null, XML_CSSML_INVALID_DATA, null, E_USER_WARNING, "Request data: {$in_CSSML}", 'XML_CSSML_Error', true);
     }
     if (get_class($this->CSSMLDoc) != 'DomDocument') {
         return PEAR::raiseError(null, XML_CSSML_INVALID_DOCUMENT, null, E_USER_WARNING, "Request data: {$in_CSSML}", 'XML_CSSML_Error', true);
     }
     $this->loaded = true;
 }
Пример #6
0
 /**
  * unpackXML::unpackXML() - constructor
  * 
  * @param $file (absolute path to file from htdocs root)
  * @return 
  */
 function unpackXML($file)
 {
     if (!($this->xml = domxml_open_file($file))) {
         $this->error = true;
         return array('error' => 'File ' . $file . ' not found at specified location. DOMXML needs an absolute path to this file starting from htdocs root or a URI!');
     } else {
         //get encoding - doesn't
         $myfile = fopen($file, "r");
         $contents = fread($myfile, 64);
         fclose($myfile);
         eregi("encoding=\"(.*)\"\\?>", $contents, $encoding);
         if (!empty($encoding[1]) and $encoding[1] != 'iso-8859-1') {
             $this->encoding = $encoding[1];
         } else {
             $this->encoding = "UTF-8";
         }
         //set root
         $this->root = $this->xml->root();
     }
 }
 function structure_reader($structure_file)
 {
     $dom = domxml_open_file($structure_file);
     if (!$dom) {
         $this->error = "STRUCTURE ERROR";
         return false;
     }
     $this->document = $dom->first_child();
     $element = $this->document->first_child();
     $i = 0;
     while ($element) {
         if ($element->node_name() == "page") {
             $this->pages[$i] = new page($element->get_attribute("name"));
             if ($element->get_attribute("title")) {
                 $this->pages[$i]->set_title($element->get_attribute("title"));
             }
             $i++;
         }
         $element = $element->next_sibling();
     }
 }
Пример #8
0
function SMB_ReadCfg($cfg) {
  if ( file_exists($cfg) ) {
    $dom = domxml_open_file($cfg);
    $node = $dom->get_elements_by_tagname("Server");
    $smb["Server"] = $node[0]->get_content();
    $node = $dom->get_elements_by_tagname("Share");
    $smb["Share"] = $node[0]->get_content();
    $node = $dom->get_elements_by_tagname("Domain");
    $smb["Domain"] = $node[0]->get_content();
    $node = $dom->get_elements_by_tagname("User");
    $smb["User"] = $node[0]->get_content();
    $node = $dom->get_elements_by_tagname("Password");
    $smb["Password"] = $node[0]->get_content();
  } else {
    $smb["Server"] = "";
    $smb["Share"] = "";
    $smb["Domain"] = "";
    $smb["User"] = "";
    $smb["Password"] = "";
  }
  return $smb;
}
Пример #9
0
 /**
  * readTMXml
  *
  * @param mixed $questionCount        question count
  * @param mixed $scoreFilePathAndName score file with path
  *
  * @access public
  * @return void
  */
 function readTMXml($questionCount, $scoreFilePathAndName)
 {
     // Make sure the specified file exists
     if (!file_exists($scoreFilePathAndName) || filesize($scoreFilePathAndName) <= 0) {
         return false;
     }
     $lineSkip = $questionCount + 3;
     $row_skip = 2;
     $i = 0;
     $score = array();
     $scores = '';
     if (phpversion() < 5) {
         //$lineSkip--;
         $dom = domxml_open_file($scoreFilePathAndName);
         $scores = $dom->get_elements_by_tagname('td');
         foreach ($scores as $score_tmp) {
             foreach ($score_tmp->child_nodes() as $item) {
                 if ($i > $lineSkip) {
                     if (($i - 2) % ($questionCount + 2) == 0) {
                         $score[$i - $lineSkip - 1]['team_name'] = $item->node_value();
                     } elseif (($i - 2) % ($questionCount + 2) <= $questionCount) {
                         $score[$i - $lineSkip - ($i - 2) % ($questionCount + 2) - 1]['q_' . ($i - 1) % $questionCount] = $item->node_value();
                     } else {
                         $score[$i - $lineSkip - ($questionCount + 2)]['percent'] = $item->node_value();
                     }
                 }
             }
             $i++;
         }
     } else {
         $dom = new DOMDocument();
         $dom->load($scoreFilePathAndName);
         $rows = $dom->getElementsByTagName('tr');
         foreach ($rows as $i => $row) {
             if ($i < $row_skip) {
                 continue;
             }
             foreach ($row->childNodes as $j => $item) {
                 if ($j == 0) {
                     $score[$i - $row_skip]['team_name'] = $item->nodeValue;
                 } elseif ($j == $questionCount + 1) {
                     $score[$i - $row_skip]['percent'] = $item->nodeValue;
                 } else {
                     $score[$i - $row_skip]['q_' . ($j - 1)] = $item->nodeValue;
                 }
             }
         }
         /*$scores = $dom->getElementsByTagName('td');
           foreach ($scores as $score_tmp) {
             foreach ($score_tmp->childNodes as $item) {
               if ($i > $lineSkip) {
                 if (($i-2)%($questionCount+2)==0) {
                   $score[$i-$lineSkip-1]['team_name'] = $item->nodeValue;
                 } elseif (($i-2)%($questionCount+2) <= $questionCount) {
                   $score[($i-$lineSkip-(($i-2)%($questionCount+2)))-1]['q_'.(($i-1)%($questionCount))] = $item->nodeValue;
                 } else {
                     $score[$i-$lineSkip-($questionCount+2)]['percent'] = $item->nodeValue;
                 }
               }
               }
               $i++;
           }*/
     }
     $score_tmp = array();
     foreach ($score as $temp) {
         array_push($score_tmp, $temp);
     }
     $score = $score_tmp;
     return $score;
 }
Пример #10
0
function insert($id)
{
    $XML_FILE = $_SESSION['XML_FILE'];
    $rule = unserialize($_SESSION['rule']);
    $directive = unserialize($_SESSION['directive']);
    $tab_rules = $directive->rules;
    unset($_SESSION['rule']);
    list($id_dir, $id_rule, $id_father) = explode("-", $id);
    init_file($XML_FILE);
    if (!($dom = domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) {
        echo "Error while parsing the document\n";
        exit;
    }
    $directive = getDirectiveFromXML($dom, $id_dir);
    if ($id_father != 0) {
        $tab_rules[$id_father]->nb_child = $tab_rules[$id_father]->nb_child + 1;
    }
    if ($id == $tab_rules[$id_rule]->id || $id_rule > count($tab_rules)) {
        $tab_rules[$id_rule] = $rule;
    } else {
        for ($i = count($tab_rules); $i >= $id_rule; $i--) {
            list($id_dir, $id_rule2, $id_father2) = explode("-", $tab_rules[$i]->id);
            $new_id_rule = $i + 1;
            if ($id_father2 >= $id_rule) {
                $new_id_father = $id_father2 + 1;
            } else {
                $new_id_father = $idfather2;
            }
            $newid = $id_dir . "-" . $new_id_rule . "-" . $new_id_father;
            $tab_rules[$i]->id = $newid;
            $tab_rules[$i + 1] = $tab_rules[$i];
        }
        $tab_rules[$id_rule] = $rule;
    }
    $direct = $directive->directive;
    $rules = $direct->child_nodes();
    foreach ($rules as $rule) {
        $direct->remove_child($rule);
    }
    do_directive($directive, &$tab_rules, $dom);
    $dom->dump_file($XML_FILE);
    release_file($XML_FILE);
    $newlevel = $tab_rules[$id_rule]->level;
    echo "<html><body onload=\"window.open('../viewer/index.php?directive=" . $directive->id . "&level={$newlevel}','right')\"></body></html>";
}
Пример #11
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;
}
Пример #12
0
function getElevation($lat, $lng, $source)
{
    $msg = "";
    switch ($source) {
        case "gmaps":
            $url = "http://maps.google.com/maps/api/elevation/xml?locations=" . $lat . "," . $lng . "&sensor=false";
            if (!($dom = @domxml_open_file($url))) {
                die("Error opening xml file");
            }
            $xpath = @xpath_new_context($dom);
            if ($_lat = @xpath_eval_expression($xpath, '//location/lat/text()')) {
                $_lat = $_lat->nodeset[0]->node_value();
            }
            if ($_lng = @xpath_eval_expression($xpath, '//location/lng/text()')) {
                $_lng = $_lng->nodeset[0]->node_value();
            }
            if ($alt = @xpath_eval_expression($xpath, '//elevation/text()')) {
                $alt = $alt->nodeset[0]->node_value();
                $msg = "";
            } else {
                if ($msg = @xpath_eval_expression($xpath, '//status/text()')) {
                    $msg = $msg->nodeset[0]->node_value();
                }
            }
            $ds = '';
            break;
        case "usgs":
            $url = "http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx/getElevation?X_Value=" . $lng . "&Y_Value=" . $lat . "&Elevation_Units=METERS&Source_Layer=-1&Elevation_Only=-1";
            //$dom = @domxml_open_file($url);
            if (!($dom = @domxml_open_file($url))) {
                die("Error opening xml file");
            }
            $xpath = @xpath_new_context($dom);
            if ($_lat = @xpath_eval_expression($xpath, '//Y_Value/text()')) {
                $_lat = $_lat->nodeset[0]->node_value();
            }
            if ($_lng = @xpath_eval_expression($xpath, '//X_Value/text()')) {
                $_lng = $_lng->nodeset[0]->node_value();
            }
            //if ($alt = @xpath_eval_expression($xpath, '//Elevation/text()')) {
            if ($alt = @xpath_eval_expression($xpath, '//Elevation_Only/text()')) {
                $alt = $alt->nodeset[0]->node_value();
                $msg = "";
            } else {
                if ($msg = @xpath_eval_expression($xpath, '//Elevation_Query/text()')) {
                    $msg = $msg->nodeset[0]->node_value();
                }
            }
            //if ($ds = @xpath_eval($xpath, '//Data_Source/text()')) {
            if ($ds = @xpath_eval_expression($xpath, '//Source_Layer/text()')) {
                $ds = $ds->nodeset[0]->node_value();
            }
            break;
        case "geonames":
            $url = "http://ws.geonames.org/srtm3?lat=" . $lat . "&lng=" . $lng . "&style=full&type=XML";
            //$dom = @domxml_open_file($url);
            if (!($dom = @domxml_open_file($url))) {
                die("Error opening xml file");
            }
            $xpath = @xpath_new_context($dom);
            if ($_lat = @xpath_eval_expression($xpath, '//lat/text()')) {
                $_lat = $_lat->nodeset[0]->node_value();
            }
            if ($_lng = @xpath_eval_expression($xpath, '//lng/text()')) {
                $_lng = $_lng->nodeset[0]->node_value();
            }
            if ($alt = @xpath_eval_expression($xpath, '//srtm3/text()')) {
                $alt = $alt->nodeset[0]->node_value();
                $alt = $alt == '-32768' ? 0 : $alt;
                $msg = "";
            }
            /* else {
            				if ($msg = @xpath_eval_expression($xpath, '//Elevation_Query/text()')) {
            					$msg = $msg->nodeset[0]->node_value();
            				}
            			}*/
            $ds = 'SRTM3';
            break;
        default:
            exit;
    }
    return array("lat" => $_lat, "lng" => $_lng, "alt" => $alt, "src" => $ds, "msg" => $msg, "url" => $url);
}
Пример #13
0
 function Load($filename)
 {
     $filepath = realpath($filename);
     if (EWRPT_IS_PHP5) {
         return $this->XmlDoc->load($filepath);
     } else {
         if (function_exists("domxml_open_file")) {
             $this->XmlDoc = domxml_open_file($filepath);
         }
         return $this->XmlDoc;
     }
 }
Пример #14
0
    {
        $this->test_var4 = $value;
        echo "test_var4 property set to {$value}<br />\n";
        return true;
    }
    function disp()
    {
        echo "<pre>";
        var_dump($this);
        echo "</pre>";
    }
}
$obj = new test_class(1, 'arg2');
$obj->set_var1('test1');
$obj->set_var2(123);
$obj->set_var3($a);
/* Array from previous test */
$obj->set_var4(array(1, 2, 3, 4, 5, 6, 7, 8, 9));
$obj->disp();
?>
<h2>And finally a bit of XML and XSLT</h2>
<?php 
$xml = domxml_open_file('presentations/slides/intro/menu.xml');
$xsl = domxml_xslt_stylesheet_file('presentations/slides/intro/menu.xsl');
$out = $xsl->process($xml);
echo $out->dump_mem();
?>
</p>
</body>
</html>
Пример #15
0
function yahoo_geocode($location)
{
    if (!preg_match('/\\[(.+),[ ]?(.+)\\]/', $location, $matches)) {
        $client = new Snoopy();
        $client->agent = GEOPRESS_USER_AGENT;
        $client->read_timeout = GEOPRESS_FETCH_TIMEOUT;
        $client->use_gzip = GEOPRESS_USE_GZIP;
        $url = yahoo_geocoder . urlencode($location);
        @$client->fetch($url);
        $xml = $client->results;
        $dom = domxml_open_file($xml);
        $lat = "";
        $lon = "";
        // $lat = $dom->get_elements_by_tagname('Latitude')[0].child_nodes()[0]->node_value();
        // $lon = $dom->get_elements_by_tagname('Longitude')[0].child_nodes()[0]->node_value();
        // $latlong = "";
        // if (preg_match("/<Latitude>(.*)<\/Latitude>.*<Longitude>(.*)<\/Longitude>/", $xml, $latlong)) {
        //   $lat = $latlong[1];
        //   $lon = $latlong[2];
        // }
    } else {
        $lat = $matches[1];
        $lon = $matches[2];
    }
    return array($lat, $lon);
}
Пример #16
0
<?php

# ------------------------------------------------------------------------------------
# MARIS XDS REGISTRY
# Copyright (C) 2007 - 2010  MARiS Project
# Dpt. Medical and Diagnostic Sciences, University of Padova - csaccavini@rad.unipd.it
# This program is distributed under the terms and conditions of the GPL
# Contributor(s):
# A-thon srl <*****@*****.**>
# Alberto Castellini
# See the LICENSE files for details
# ------------------------------------------------------------------------------------
include_once '../config/registry_mysql_db.php';
##### CREO L'OGGETTO DOM
//$dom_initialize = domxml_open_file('../config/Initialize_05-Dec-2005_1315/initialize.xml');
$dom_initialize = domxml_open_file('../config/initialize.xml');
//$dom_initialize = domxml_open_file('config/Initialize_05-Dec-2005_1315/upgrade-from-year-1-to-year-2.xml');
##### RADICE DEL DOCUMENTO
$root_dom_initialize = $dom_initialize->document_element();
##### ARRAY DEI NODI LeafRegistryObjectList
$dom_LeafRegistryObjectList_node_array = $root_dom_initialize->get_elements_by_tagname("LeafRegistryObjectList");
#### CICLO SU OGNI LeafRegistryObjectList ####
for ($i = 0; $i < count($dom_LeafRegistryObjectList_node_array); $i++) {
    #### SINGOLO NODO LeafRegistryObjectList
    $dom_LeafRegistryObjectList_node = $dom_LeafRegistryObjectList_node_array[$i];
    #### NODI ClassificationScheme
    $dom_ClassificationScheme_node_array = $dom_LeafRegistryObjectList_node->get_elements_by_tagname("ClassificationScheme");
    for ($s = 0; $s < count($dom_ClassificationScheme_node_array); $s++) {
        ### SINGOLO NODO ClassificationScheme
        $dom_ClassificationScheme_node = $dom_ClassificationScheme_node_array[$s];
        ### ATTRIBUTO id
Пример #17
0
ossim_valid($category_file, OSS_ALPHA, OSS_DOT, OSS_SCORE, OSS_NULLABLE, 'illegal:' . _("xml_file"));
ossim_valid($category_name, OSS_LETTER, OSS_DIGIT, OSS_SCORE, OSS_SPACE, OSS_NULLABLE, 'illegal:' . _("name"));
ossim_valid($query, OSS_TEXT, OSS_PUNC, OSS_NULLABLE, 'illegal:' . _("query"));
if (ossim_error()) {
    die(ossim_error());
}
if ($action == "enable_category") {
    enable_category($category_name, $category_file);
} elseif ($action == "disable_category") {
    disable_category($category_name, $category_file);
}
init_groups();
init_categories();
$conf = $GLOBALS["CONF"];
$XML_FILE = '/etc/ossim/server/directives.xml';
$xml = domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES);
// Edit Disallowed categories
$cannotedit = array("alienvault-attacks.xml" => 1, "alienvault-bruteforce.xml" => 1, "alienvault-dos.xml" => 1, "alienvault-malware.xml" => 1, "alienvault-misc.xml" => 1, "alienvault-network.xml" => 1, "alienvault-policy.xml" => 1, "alienvault-scada.xml" => 1, "alienvault-scan.xml" => 1, "alienvault-worms.xml" => 1, "abnormal.xml" => 1, "attacks.xml" => 1, "dos.xml" => 1, "generic.xml" => 1, "misc.xml" => 1, "network.xml" => 1, "scan.xml" => 1, "trojans.xml" => 1, "webattack.xml" => 1, "worms.xml" => 1);
$categories = unserialize($_SESSION['categories']);
$tab = $xml->get_elements_by_tagname('directive');
$search_results = array();
foreach ($tab as $lign) {
    $field = $lign->get_attribute('name');
    if (preg_match("/{$query}/i", $field)) {
        $search_results[$lign->get_attribute('id')] = $lign;
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
		<head>
Пример #18
0
    } else {
        exit;
    }
}
$modifytime = @filemtime($xmlfile);
if (cache_header("public", $modifytime, 1800)) {
    return;
}
$channel["title"] = BBS_FULL_NAME . " " . ($h == 2 ? constant("BBS_SECNAME" . $s . "_0") . "区" : "今日") . "十大热门话题";
$channel["description"] = BBS_FULL_NAME . date("Y年m月d日", $modifytime);
if ($h == 2) {
    $channel["description"] .= constant("BBS_SECNAME" . $s . "_0") . "区";
}
$channel["description"] .= "十大热门话题";
$channel["lastBuildDate"] = gmt_date_format(time());
$doc = domxml_open_file($xmlfile);
if (!$doc) {
    return;
}
$root = $doc->document_element();
$boards = $root->child_nodes();
$brdarr = array();
$item = array();
while ($board = array_shift($boards)) {
    if ($board->node_type() == XML_TEXT_NODE) {
        continue;
    }
    $brdname = find_content($board, "board");
    $brdnum = bbs_getboard($brdname, $brdarr);
    if ($brdnum == 0) {
        continue;
Пример #19
0
    $nomefile = substr($modello, 0, strlen($modello) - 4) . "{$idpratica}.sxw";
}
$dir = "gestione_stampe/tmp";
if (!is_dir($dir)) {
    mkdir($dir);
}
$dir_modelli = "/gestione_stampe/modelli/";
$dir_save = getcwd() . "/gestione_stampe/" . $_SESSION["USERNAME"];
if (!is_dir($dir_save)) {
    mkdir($dir_save);
}
// unzippo il modello del documento
if (unpackZip($dir_modelli . $modello, $dir . "/")) {
    //echo "Dovrei aver scompattato!!!!<br>";
    //Acquisisco il file xml
    if (!($dom = domxml_open_file(getcwd() . "/{$dir}/content.xml"))) {
        echo "error";
        exit;
    }
}
$db = new sql_db($dbhost, $dbuname, $dbpass, $dbname, false);
if (!$db->db_connect_id) {
    die("Impossibile connettersi al database {$dbtype}");
}
$root = $dom->document_element();
$start = $root->get_elements_by_tagname("body");
$lista_field = $root->get_elements_by_tagname("user-field-get");
$out = get_table_fields($root);
$risultato = array();
//Ciclo sulle Tabelle
foreach ($out as $key => $value) {
Пример #20
0
                if ($level > 1) {
                    if ($rule->has_child_nodes()) {
                        $rules = $rule->child_nodes();
                        foreach ($rules as $rule) {
                            rule_table($dom, $directive_id, $rule, $level - 1, $ilevel);
                        }
                    }
                }
                $branch++;
            }
        }
        /* foreach */
    }
}
/* create dom object from a XML file */
if (!($dom = @domxml_open_file($XML_FILE, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) {
    echo "Error while parsing the document\n";
    exit;
}
if (!empty($directive_id)) {
    $directive = finddirective($dom, $directive_id);
    if ($directive_id && !is_null($directive)) {
        if (empty($level)) {
            $level = 1;
        }
        $_SESSION["path"] = 0;
        rule_table_header($directive_id, $level, $directive->get_attribute('priority'));
        rule_table($dom, $directive_id, $directive, $level, $level);
        rule_table_foot();
    }
    $db->close($conn);
 /**
 Ouvre tous les fichiers XML données et les retourne en tant que noeud XML
 */
 function fichiers_vers_xml($array_fichiers)
 {
     $dom_all = domxml_new_doc("1.0");
     $root_all = $dom_all->create_element("fichiers");
     foreach ($array_fichiers as $key => $fichier_xml) {
         $dom = domxml_open_file(getcwd() . "/" . $fichier_xml);
         $root = $dom->document_element();
         $root_all->append_child($root->clone_node(true));
     }
     $dom_all->append_child($root_all);
     return $root_all;
 }
Пример #22
0
function open_file($file)
{
    init_file($file);
    if (!($dom = domxml_open_file($file, DOMXML_LOAD_SUBSTITUTE_ENTITIES))) {
        echo _("Error while parsing the document") . "\n";
        exit;
    }
    return $dom;
}
Пример #23
0
<?php

# ------------------------------------------------------------------------------------
# MARIS XDS REGISTRY
# Copyright (C) 2007 - 2010  MARiS Project
# Dpt. Medical and Diagnostic Sciences, University of Padova - csaccavini@rad.unipd.it
# This program is distributed under the terms and conditions of the GPL
# Contributor(s):
# A-thon srl <*****@*****.**>
# Alberto Castellini
# See the LICENSE files for details
# ------------------------------------------------------------------------------------
include_once '../config/registry_QUERY_mysql_db.php';
$dom_affinity_domain = domxml_open_file('../config/AffinityDomain_17-Nov-2005_1303/codes.xml');
##### RADICE DEL DOCUMENTO
$root_dom_affinity_domain = $dom_affinity_domain->document_element();
##### ARRAY DEI NODI CodeType
$dom_CodeType_node_array = $root_dom_affinity_domain->get_elements_by_tagname("CodeType");
#### CICLO SU OGNI CodeType ####
for ($index = 0; $index < count($dom_CodeType_node_array); $index++) {
    ##### SINGOLO NODO CodeType
    $dom_CodeType_node = $dom_CodeType_node_array[$index];
    #### name ATTRIBUTE
    $CodeType_name_attr = $dom_CodeType_node->get_attribute('name');
    #### classScheme ATTRIBUTE
    $CodeType_classScheme_attr = $dom_CodeType_node->get_attribute('classScheme');
    #### INSERISCO NELLA TABELLA classScheme
    $insert_classScheme = "INSERT INTO classScheme (class_Scheme,name) VALUES ('{$CodeType_classScheme_attr}','{$CodeType_name_attr}')";
    # open connection to db
    $connessione = mysql_connect($ip_q, $user_db_q, $password_db_q) or die("Connessione non riuscita: " . mysql_error());
    # open  db
Пример #24
0
<?php

//
// Ìàêñèìàëüíîå êîë-âî ïîäêàòåãîðèé â êàòåãîðèè
//
define("MAX_LENGTH", 10);
$Dom = domxml_open_file("job.xml");
if ($Dom) {
    optimizeCategories($Dom, $Dom->document_element());
    $Dom->dump_file("new_job.xml");
    print "Editing of job.xml completed.\n";
} else {
    print "Error on load xml file.\n";
}
function findUL($root)
{
    $nodes = $root->child_nodes();
    for ($i = 0; $i < sizeof($nodes); $i++) {
        if (strcasecmp($nodes[$i]->node_name(), "UL") == 0) {
            return $nodes[$i];
        }
    }
    return null;
}
function getCategories($root)
{
    $xpath = xpath_new_context($root);
    $listNode = xpath_eval($xpath, "UL");
    if (sizeof($listNode->nodeset) == 0) {
        $xpath = xpath_new_context($root);
        $nodes = xpath_eval($xpath, "LI");
Пример #25
0
		<script type="text/javascript" language="javascript" src="javascript/top.js"></script>
	</head>

	<body>

		<input type="hidden" id="is_mod" value="false" />

<?php 
$iddir = GET('iddir');
$list = GET('list');
ossim_valid($iddir, OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal: iddir');
ossim_valid($list, OSS_ALPHA, OSS_PUNC, OSS_SPACE, OSS_NULLABLE, 'illegal: list');
if (ossim_error()) {
    die(ossim_error());
}
if (!($dom = domxml_open_file('/etc/ossim/server/directives.xml', DOMXML_LOAD_SUBSTITUTE_ENTITIES))) {
    echo _("Error while parsing the document") . "\n";
    exit;
}
$table = array();
$table_dir = $dom->get_elements_by_tagname('directive');
foreach ($table_dir as $dir) {
    $table[$dir->get_attribute('id')] = $dir->get_attribute('name');
}
ksort($table);
$groups = unserialize($_SESSION['groups']);
?>
<center>
		<table class="transparent" width="100%"><tr><th style="padding:5px;font-size:12px"><?php 
echo gettext("List of groups");
?>
Пример #26
0
<?php

/**
 * Create a CopixDao schema from a creation one: first step (see doCopixSchema2.php)
 * Use Pear::MDB library
 * 
 */
define('LIB_MDB', '');
require_once LIB_MDB . 'MDB.php';
MDB::loadFile('Manager');
$creation_schema_file = 'mdb-schema.xml';
$CopixDao_schema_file = 'dao-definition0.xml';
// load a document
$source = domxml_open_file(realpath($creation_schema_file));
// load thefirst style sheet
$stylesheet = domxml_xslt_stylesheet_file(realpath('e2a.xsl'));
// apply the style sheet to the document
$result = $stylesheet->process($source, array('with-namespace' => 'no'));
// save the styled document
$result->dump_file(realpath($CopixDao_schema_file));
echo "\n<br>End of process #0. \n<br>";
function xmldocfile($filename)
{
    return domxml_open_file($filename);
}
Пример #28
0
    BLR is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with Foobar; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/
// Inclusion des fichiers nécessaires
require_once 'db.php';
require_once 'url.class.php';
require_once 'dossier.class.php';
require_once 'livre.class.php';
header("content-type: text/plain; charset=utf-8");
if (!($dom = domxml_open_file(realpath("test.xml")))) {
    echo "Erreur lors de l'analyse du document\n";
    exit;
}
$root = $dom->document_element();
$fils = $root->first_child();
function tab($taille)
{
    $chaine = '';
    for ($i = 1; $i <= $taille; $i++) {
        $chaine .= "\t";
    }
    return $chaine;
}
function listeElementNoeudCourant($noeud, $numDossier, $iter = 0)
{
Пример #29
0
	<?php 
if ($_REQUEST["op"] != "Import") {
    ?>
	
	<h2>Import XMLDB</h2>

	<form	enctype="multipart/form-data" method="POST" action="xml-import.php">
	File: <input name="xmldb" type="file">&nbsp;
	<input class="button" name="op" type="submit" value="Import">
	</form>

	<?php 
} else {
    print "<h2>Importing data</h2>";
    if (is_file($_FILES['xmldb']['tmp_name'])) {
        $dom = domxml_open_file($_FILES['xmldb']['tmp_name']);
        //			$dom = domxml_open_file('xmldb.xml');
        if ($dom) {
            $root = $dom->document_element();
            $schema_version = $root->get_elements_by_tagname('schema_version');
            $schema_version = $schema_version[0]->get_content();
            if ($schema_version > MAX_SOURCE_SCHEMA_VERSION) {
                die("Incorrect source schema version");
            }
            $articles = $root->get_elements_by_tagname("article");
            foreach ($articles as $article) {
                $child_nodes = $article->child_nodes();
                $article_data = array();
                foreach ($child_nodes as $child) {
                    $article_data[$child->tagname()] = $child->get_content();
                }
    $srcxpath = $srcxml->xpath_new_context();
    //xpath context for source xml
    $newxpath = $newxml->xpath_new_context();
    //xpath context for changed content
    $id = $newxpath->xpath_eval('./@ID');
    //get the id from the changed element
    $cnt = $newxpath->xpath_eval('.');
    //get the node which will be replaced
    $nd1 = getNodeById($srcxml->root(), $id->nodeset[0]->value);
    $prnt = $nd1->parent_node();
    $prnt->replace_child($cnt->nodeset[0], $nd1);
    //echo $srcxml->dump_mem(true);
    //echo $filename;
    //echo $srcxml->dump_file($filename,false,true);
    $srcxml->dump_file($filename, false, true);
}
if (isset($contents)) {
    //echo "<test>".html_entity_decode($contents)."</test>";
} else {
    //TODO extension �berpr�fen !!!!!
    if (isset($filename)) {
        //echo $filename;
        if (file_exists($filename)) {
            //load the given file as xml and echo the contents
            $dom = domxml_open_file($filename);
            echo $dom->dump_mem(true);
        } else {
            echo "<error>file does not exist -  {$filename}</error>";
        }
    }
}