index.php 5.21 KB
<?php
/**
 * @file	index.inc.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,
 *
 *	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/php/TreeRequireClass.$_TREE.inc.php");
require_once("../../include/System/php/RequireClass.inc.php");

header('Content-Type: text/html; charset='.$_LOSP_CHARSET);


/**	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', $_PAGE_NAME);

/** Sprache */
$DOMLanguage = new DOMDocument('1.0', $_LOSP_CHARSET);

if(array_key_exists(CONSTKindOf::LANG,$_GET)){
	$langName=Language::getLanguageFilename($_GET[CONSTKindOf::LANG]);
}
else{
	$langName=Language::getLanguageFilename();
}


$DOMLanguage->load($_PAGEDIR.'/include/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));
}

$DOMElement_HTMLTagHead = $DOMDocument->createElement("XMLSite_Head");
require_once($_PAGEDIR.'/include/php/TreeIndex.'.$_PAGE_NAME.'.inc.php');

/** HTML Header */

$DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("title","mensch.coop e.G."));
$DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("description","mensch.coop e.G. Seite"));
//$DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("title",$_TITLE));
//$DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("description",$_DESCRIPTION));
$DOMElement_HTMLTagHead->appendChild($DOMDocument->createElement("root",$_LOSP_ROOT));

/** 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($_PAGEDIR.'/include/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();

}

if($_LOSP_DEV_XMLOUTPUT) {
	file_put_contents ( $_LOSP_PATH_TO_ROOT."Temp/XMLOutput.index.$_PAGE_NAME.xml",  $DOMDocument->saveXML());
	file_put_contents ( $_LOSP_PATH_TO_ROOT."Temp/D_Output.index.$_PAGE_NAME.xml",  D::getString());

}
?>