Nextrek
@ 787
Nextrek / legal-map / ajax / openArticle.php
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
<?php require_once("SimpleXMLExtended.php"); if (file_exists(dirname(__FILE__)."/../articoli/".$_REQUEST["html"])) { $d = new DOMDocument; $mock = new DOMDocument; $d->loadHTML(file_get_contents(dirname(__FILE__)."/../articoli/".$_REQUEST["html"])); $body = $d->getElementsByTagName('body')->item(0); foreach ($body->childNodes as $child){ $mock->appendChild($mock->importNode($child, true)); } echo $mock->saveHTML(); if (isset($_REQUEST["popup"])) { $xmlRoot; if (file_exists(dirname(__FILE__)."/../itinerari/".$_COOKIE["lm-session"].".xml")) { $xmlRoot = simplexml_load_file(dirname(__FILE__)."/../itinerari/".$_COOKIE["lm-session"].".xml", 'SimpleXMLExtended'); $articoloNodo = $xmlRoot->xpath('//articolo[@articoloId="'.$_REQUEST["padreArt"].'"]')[0]; $articoloPopup = $articoloNodo->addChild("articolopopup"); $intestazione = $articoloPopup->addChild("intestazione"); $intestazione->addCData($d->getElementsByTagName('title')->item(0)->textContent); $xmlRoot->saveXML(dirname(__FILE__)."/../itinerari/".$_COOKIE["lm-session"].".xml"); } } } else { header($_SERVER['SERVER_PROTOCOL'] . ' 404 File Not Found', true, 404); echo "<b>File Not Found</b>"; } ?> |