<?php /** * @file index.php * @category freeSN * @mailto code [at] netz.coop * @version 0.4.200901 * @link http://netz.coop * * @copyright Copyright by netz.coop e.G. 2015 * * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program 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 this program. If not, see <http://www.gnu.org/licenses/>. * */ /** * Definitionen und Umwandlung von $_POST[] und $_GET[] Variablen finden * in der statischen Controller Klasse (Controller.php) * und in den globalen Variablen von xsl (default_GlobalVariable.xsl) statt, * ansonsten hier in index.php der Funktionsaufruf * * Formulare ($_POST[] und $_GET[]) sind definiert XSL * * default.xsl * * Tabellennamen sind definiert in der CONSTKindOf Klasse * XMLTagnamen sind definiert in der CONSTKindOf Klasse und default.xsl * */ require_once("include/config.php"); require_once("include/System/php/RequireClass.inc.php"); //echo '<pre>Hallo:.....'; //print_r($_TREE); //echo '</pre>'; //return; header('Content-Type: text/html; charset='.$_LOSP_CHARSET); //D::show($_POST,'post',1,1); /** Klassen die standard mäßig benötigt werden */ $DB = StorableFactory::create($_LOSP_STORABLE_KINDOF, $_LOSP_STORABLE_DATA); $HostAccount = BasisElement::createNewInstance($DB, 'Account', 0, $param_PartOf=null); $DOMDocument = new DOMDocument('1.0', $_LOSP_CHARSET); $DOMDocument->formatOutput = TRUE; $Content = $DOMDocument->appendChild($DOMDocument->createElement('content')); $Content->setAttribute('Tree', $_TREE); /** * @todo Language in eigen Klasse * Sprache * */ $DOMLanguage = new DOMDocument('1.0', $_LOSP_CHARSET); if(array_key_exists(CONSTKindOf::LANG,$_GET)){ // D::show($_COOKIE); $langName=Language::getLanguageFilename($_GET[CONSTKindOf::LANG]); setcookie(CONSTKindOf::LANG, $_GET[CONSTKindOf::LANG]); } else if(array_key_exists(CONSTKindOf::LANG,$_COOKIE)){ $langName=Language::getLanguageFilename($_COOKIE[CONSTKindOf::LANG]); } else{ $langName=Language::getLanguageFilename(); } if(isset($_LOSP_LANGUAGE_XML)&& $_LOSP_LANGUAGE_XML === true){ $DOMLanguage->load($_LOSP_PATH_TO_ROOT.'include/Forest/'.$_TREE.'/Design/'.$_LOSP_DESIGNDIR.'/language/'.$langName); } if(!$DOMLanguage->documentElement){ Error::newError("Language","Language file ".$langName." does not exist!","256"); } else{ Language::addISOLanguages($DOMLanguage); $Content->appendChild($DOMDocument->importNode($DOMLanguage->documentElement, true)); if(array_key_exists('p', $_GET) && (in_array('edit',$_GET['p']) or in_array('makeNew',$_GET['p']))){ $DOMLanguageEdit = new DOMDocument('1.0', $_LOSP_CHARSET); $DOMLanguageEdit->load($_LOSP_PATH_TO_ROOT.'include/Forest/'.$_TREE.'/Design/'.$_LOSP_DESIGNDIR.'/language/edit'.$langName); if($DOMLanguageEdit->documentElement){ $Content->appendChild($DOMDocument->importNode($DOMLanguageEdit->documentElement, true)); } } } $DOMElement_HTMLTagHead = $DOMDocument->createElement("XMLSite_Head"); require_once($_LOSP_PATH_TO_ROOT.'include/Forest/'.$_TREE.'/Design/'.$_LOSP_DESIGNDIR.'/php/TreeIndex.'.$_LOSP_DESIGNDIR.'.inc.php'); /** HTML Header */ $DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("title",Converter::encodeString($_TITLE,1))); $DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("description",Converter::encodeString($_DESCRIPTION,1))); /** Url header */ $_URL=$DOMDocument->createElement("url"); $_URL->setAttribute('parameter', '?'.urldecode(http_build_query($_GET))); foreach($_GET as $key => $value){ if($key=='p'){ $tmp='?'; } else{ $tmp='&'; } $tmp_url[$key]=$_GET[$key]; $tmp_url = $tmp.urldecode(http_build_query($tmp_url)); if(substr($tmp_url,-1) == '='){ $tmp_url = substr($tmp_url,0,-1); } $_URL->setAttribute($key, $tmp_url); unset($tmp_url); } $DOMElement_HTMLTagHead->appendChild($_URL); $XMLStylesheet = $DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("XMLStylesheet")); $XMLStylesheet->appendChild($DOMDocument->createElement("href",$var_css)); $XMLStylesheet->appendChild($DOMDocument->createElement("name","default")); /** XSLTProcessor */ $stylesheet = new DOMDocument; $stylesheet->load($_LOSP_PATH_TO_ROOT.'include/Forest/'.$_TREE.'/Design/'.$_LOSP_DESIGNDIR.'/xsl/default.xsl'); $processor = new XSLTProcessor; $processor->registerPHPFunctions(); $processor->importStylesheet($stylesheet); $DB->disconnect(); /** die eigentliche Ausgabe */ echo $processor->transformToDoc($DOMDocument)->saveXML(); if($_LOSP_DEV) { /** * @if $_LOSP_DEV (kann innerhalb @see config gesetzt werden) * * folgende Ausgaben sind nur für die Entwicklungszeit gedacht */ $var_ErrorWarnString = date('d. m. Y G:i:s').': '; if(ErrorEvent::$count_handleError || ErrorEvent::$count_handleNotice) { if(ErrorEvent::$count_handleError) { $var_ErrorWarnString .= '<a href="'.$_E_LOGFILE_ERROR.'" style=\"font-size:15;color:red;\">Error('.ErrorEvent::$count_handleError.')</a> '; } else { $var_ErrorWarnString .= 'Error(0) '; } if(ErrorEvent::$count_handleNotice) { $var_ErrorWarnString .= '<a href="'.$_E_LOGFILE_WARNINGNOTICE.'" style=\"font-size:15;color:red;\">Warn('.ErrorEvent::$count_handleNotice.')</a>'; } else { $var_ErrorWarnString .= 'Warn(0)'; } } else { $var_ErrorWarnString .= 'Error/Warn/Note(0)'; } D::showGeneralSoftwareAbstractInfos(); // D::show(CONFIG::getMT_BasisClipboards('Profile', $param_ask='BasisClipboards'), 'asdfasdfasdf'); } if($_LOSP_DEV_XMLOUTPUT) { file_put_contents ( $_LOSP_PATH_TO_ROOT."Temp/XMLOutput.index.$_TREE.xml", $DOMDocument->saveXML()); file_put_contents ( $_LOSP_PATH_TO_ROOT."Temp/D_Output.index.$_TREE.xml", D::getString()); //$var_SimpleXMLElement = simplexml_load_string($DOMDocument->saveXML()); // if(get_class($var_SimpleXMLElement)=='SimpleXMLElement') { //D::show($var_SimpleXMLElement); // } // else { // D::li('NEIN'); // } } ?>