Exemplo n.º 1
0
 public static function load_xml($header, $path, $name, $root = "")
 {
     $filePath = system::OLIV_MODULE_PATH();
     // use module name from header
     if ($header) {
         $filePath .= (string) $header->name . "/";
     }
     $filePath .= $path;
     //TODO
     // load system file
     if (strtolower($root) == "system") {
         if (olivfile_exists($filePath . $name)) {
             return olivxml_load_file($filePath . $name);
         }
     } else {
         if (sessionfile_exists($filePath . $name)) {
             $xml = sessionxml_load_file($filePath . $name);
             // if access defined and write access -> enable editing
             if ($xml->access->getName()) {
                 // read access -> display
                 if (!OLIVRight::r($xml->access)) {
                     $xmlName = $xml->getName();
                     return new simpleXmlElement("<{$xmlName}/>");
                 } elseif (OLIVRight::w($xml->access)) {
                     OLIVText::writeSource($xml, $filePath . $name);
                 }
             }
             //TODO write imagesource
             //			OLIVImage::writeSource($xml,$filePath);
             return $xml;
         } else {
             OLIVError::warning("module.php::load_xml - {$root}{$filePath}{$name} not found");
         }
     }
 }
Exemplo n.º 2
0
 public function scan($lang)
 {
     $path = system::OLIV_PAGE_PATH() . "page.xml";
     if (sessionfile_exists($path)) {
         $pageXml = sessionxml_load_file($path);
         status::set("pages", $pageXml->define);
         status::set("pagestructure", $pageXml->structure);
         OLIVText::writeSource(status::pages(), $path);
     } else {
         OLIVError::fire("page::scan - page.xml not found -> rescan");
     }
 }