index.php
6.26 KB
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
<?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');
// }
}
?>