function printNode($key, $valueTree, $isAssignment = false) { global $format; if ($isAssignment) { if ($format == "perl") { echo "{$key} = {"; } else { echo "{$key} = array("; } } else { if (strcmp($key, "!") == 0) { if ($format == "perl") { echo "'!' => {}"; } else { echo "'!' => ''"; } return; } else { if ($format == "perl") { echo "'{$key}' => {"; } else { echo "'{$key}' => array("; } } } $keys = array_keys($valueTree); for ($i = 0; $i < count($keys); $i++) { $key = $keys[$i]; printNode($key, $valueTree[$key]); if ($i + 1 != count($valueTree)) { echo ",\n"; } else { "\n"; } } if ($format == "perl") { echo '}'; } else { echo ')'; } }
$b = mysql_query("UPDATE ftree SET spouse=" . $u->getId() . " WHERE id=" . $currNode); } } } $vspacer = "<br><br><br><br><br><br><br><br>\n"; $hspacer = "<div class=\"hspacer\"></div>"; $body = "\n<body onunload=\"chart.unload();\">\r\n<div id=\"ftree\">\r\n<form id=\"form0\" action=\"index.php\" method=\"post\">\r\n<input type=\"hidden\" id=\"currNode\" name=\"currNode\" value =\"\"/>\r\n<input type=\"hidden\" id=\"name\" name=\"name\" value =\"\"/>\r\n<input type=\"hidden\" id=\"type\" name=\"type\" value =\"\"/>\r\n</form>\n"; $script = ""; $q = mysql_query("SELECT * FROM ftree where father=-1 AND mother=-1 ORDER BY id ASC"); $root = new User(mysql_fetch_assoc($q)); $next = array(array($root)); while (sizeof($next)) { $nnext = array(); foreach ($next as $node) { foreach ($node as $nnode) { $tmp = printNode($nnode); $body = $body . $tmp['body']; $script = $script . $tmp['script']; array_push($nnext, $tmp['next']); } if (sizeof($node)) { $body = $body . $hspacer; } } if (sizeof($nnext)) { $body = $body . $vspacer; } $next = $nnext; } $script = $script . "\n});\n</script></head>"; echo $script;
<table border="1"> <?php $res = $xpath->query('//srtmcountry'); if ($res && $res->length > 0) { foreach ($res as $node) { if (file_exists('srtm-countries/' . $node->getAttribute('name'))) { printNode($node); } } } ?> </table> <h1><?php echo "Table of wiki hosted on osmand.net"; ?> </h1> <table border="1"> <?php $res = $xpath->query('//wiki'); if ($res && $res->length > 0) { foreach ($res as $node) { if (file_exists('wiki/' . $node->getAttribute('name'))) { printNode($node); } } } ?> </table> </body> </html>