Rev 3 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3 | Rev 10 | ||
---|---|---|---|
1 | <?php |
1 | <?php |
2 | 2 | ||
3 | if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgeführt werden.'); |
3 | if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgeführt werden.'); |
4 | 4 | ||
5 | ////////////////////////////////////////////////////////////////////////////// |
5 | ////////////////////////////////////////////////////////////////////////////// |
6 | // CODIERUNGSFUNKTIONEN // |
6 | // CODIERUNGSFUNKTIONEN // |
7 | ////////////////////////////////////////////////////////////////////////////// |
7 | ////////////////////////////////////////////////////////////////////////////// |
8 | 8 | ||
- | 9 | function wb_htmlentities($x) { |
|
- | 10 | return htmlentities($x, ENT_COMPAT, 'iso-8859-1'); |
|
- | 11 | } |
|
- | 12 | ||
9 | function encode_critical_html_characters($inp) |
13 | function encode_critical_html_characters($inp) |
10 | { |
14 | { |
11 | $inp = str_replace('&', '&', $inp); |
15 | $inp = str_replace('&', '&', $inp); |
12 | //$inp = str_replace('"', '"', $inp); |
16 | //$inp = str_replace('"', '"', $inp); |
13 | $inp = str_replace('<', '<', $inp); |
17 | $inp = str_replace('<', '<', $inp); |
14 | $inp = str_replace('>', '>', $inp); |
18 | $inp = str_replace('>', '>', $inp); |
15 | 19 | ||
16 | return $inp; |
20 | return $inp; |
17 | } |
21 | } |
18 | 22 | ||
19 | function decode_critical_html_characters($inp) |
23 | function decode_critical_html_characters($inp) |
20 | { |
24 | { |
21 | $inp = str_replace('&', '&', $inp); |
25 | $inp = str_replace('&', '&', $inp); |
22 | //$inp = str_replace('"', '"', $inp); |
26 | //$inp = str_replace('"', '"', $inp); |
23 | $inp = str_replace('<', '<', $inp); |
27 | $inp = str_replace('<', '<', $inp); |
24 | $inp = str_replace('>', '>', $inp); |
28 | $inp = str_replace('>', '>', $inp); |
25 | 29 | ||
26 | return $inp; |
30 | return $inp; |
27 | } |
31 | } |
28 | 32 | ||
29 | function executable_html_code($inp) |
33 | function executable_html_code($inp) |
30 | { |
34 | { |
31 | // Wenn der Benutzer z.B. ä im HTML-Formular eingegeben hat, würde hier aufgrund von Unicode quatsch rauskommen |
35 | // Wenn der Benutzer z.B. ä im HTML-Formular eingegeben hat, würde hier aufgrund von Unicode quatsch rauskommen |
32 | $inp = htmlentities($inp, ENT_COMPAT, 'UTF-8'); |
36 | $inp = wb_htmlentities($inp, ENT_COMPAT, 'UTF-8'); |
33 | 37 | ||
34 | $inp = decode_critical_html_characters($inp); |
38 | $inp = decode_critical_html_characters($inp); |
35 | 39 | ||
36 | $trans = get_html_translation_table(HTML_ENTITIES); |
40 | $trans = get_html_translation_table(HTML_ENTITIES); |
37 | foreach ($trans as $m1 => $m2) |
41 | foreach ($trans as $m1 => $m2) |
38 | { |
42 | { |
39 | if (($m2 != '<') && ($m2 != '>')) |
43 | if (($m2 != '<') && ($m2 != '>')) |
40 | { |
44 | { |
41 | $inp = str_replace(str_replace('&', '&', $m2), $m2, $inp); |
45 | $inp = str_replace(str_replace('&', '&', $m2), $m2, $inp); |
42 | } |
46 | } |
43 | } |
47 | } |
44 | unset($m1); |
48 | unset($m1); |
45 | unset($m2); |
49 | unset($m2); |
46 | 50 | ||
47 | // Erweiterte Zeichensatztabelle, die auch da Euro-Zeichen enthält |
51 | // Erweiterte Zeichensatztabelle, die auch da Euro-Zeichen enthält |
48 | // Entnommen von http://www.php.net/manual/de/function.get-html-translation-table.php#73410 |
52 | // Entnommen von http://www.php.net/manual/de/function.get-html-translation-table.php#73410 |
49 | $trans2 = array('''=>''', '−'=>'-', 'ˆ'=>'^', '˜'=>'~', 'Š'=>'Š', '‹'=>'‹', 'Œ'=>'Œ', '‘'=>'‘', '’'=>'’', '“'=>'“', '”'=>'”', '•'=>'•', '–'=>'–', '—'=>'—', '˜'=>'˜', '™'=>'™', 'š'=>'š', '›'=>'›', 'œ'=>'œ', 'Ÿ'=>'Ÿ', 'ÿ'=>'ÿ', 'Œ'=>'Œ', 'œ'=>'œ', 'Š'=>'Š', 'š'=>'š', 'Ÿ'=>'Ÿ', 'ƒ'=>'ƒ', 'ˆ'=>'ˆ', '˜'=>'˜', 'Α'=>'Α', 'Β'=>'Β', 'Γ'=>'Γ', 'Δ'=>'Δ', 'Ε'=>'Ε', 'Ζ'=>'Ζ', 'Η'=>'Η', 'Θ'=>'Θ', 'Ι'=>'Ι', 'Κ'=>'Κ', 'Λ'=>'Λ', 'Μ'=>'Μ', 'Ν'=>'Ν', 'Ξ'=>'Ξ', 'Ο'=>'Ο', 'Π'=>'Π', 'Ρ'=>'Ρ', 'Σ'=>'Σ', 'Τ'=>'Τ', 'Υ'=>'Υ', 'Φ'=>'Φ', 'Χ'=>'Χ', 'Ψ'=>'Ψ', 'Ω'=>'Ω', 'α'=>'α', 'β'=>'β', 'γ'=>'γ', 'δ'=>'δ', 'ε'=>'ε', 'ζ'=>'ζ', 'η'=>'η', 'θ'=>'θ', 'ι'=>'ι', 'κ'=>'κ', 'λ'=>'λ', 'μ'=>'μ', 'ν'=>'ν', 'ξ'=>'ξ', 'ο'=>'ο', 'π'=>'π', 'ρ'=>'ρ', 'ς'=>'ς', 'σ'=>'σ', 'τ'=>'τ', 'υ'=>'υ', 'φ'=>'φ', 'χ'=>'χ', 'ψ'=>'ψ', 'ω'=>'ω', 'ϑ'=>'ϑ', 'ϒ'=>'ϒ', 'ϖ'=>'ϖ', ' '=>' ', ' '=>' ', ' '=>' ', '‌'=>'‌', '‍'=>'‍', '‎'=>'‎', '‏'=>'‏', '–'=>'–', '—'=>'—', '‘'=>'‘', '’'=>'’', '‚'=>'‚', '“'=>'“', '”'=>'”', '„'=>'„', '†'=>'†', '‡'=>'‡', '•'=>'•', '…'=>'…', '‰'=>'‰', '′'=>'′', '″'=>'″', '‹'=>'‹', '›'=>'›', '‾'=>'‾', '⁄'=>'⁄', '€'=>'€', 'ℑ'=>'ℑ', '℘'=>'℘', 'ℜ'=>'ℜ', '™'=>'™', 'ℵ'=>'ℵ', '←'=>'←', '↑'=>'↑', '→'=>'→', '↓'=>'↓', '↔'=>'↔', '↵'=>'↵', '⇐'=>'⇐', '⇑'=>'⇑', '⇒'=>'⇒', '⇓'=>'⇓', '⇔'=>'⇔', '∀'=>'∀', '∂'=>'∂', '∃'=>'∃', '∅'=>'∅', '∇'=>'∇', '∈'=>'∈', '∉'=>'∉', '∋'=>'∋', '∏'=>'∏', '∑'=>'∑', '−'=>'−', '∗'=>'∗', '√'=>'√', '∝'=>'∝', '∞'=>'∞', '∠'=>'∠', '∧'=>'∧', '∨'=>'∨', '∩'=>'∩', '∪'=>'∪', '∫'=>'∫', '∴'=>'∴', '∼'=>'∼', '≅'=>'≅', '≈'=>'≈', '≠'=>'≠', '≡'=>'≡', '≤'=>'≤', '≥'=>'≥', '⊂'=>'⊂', '⊃'=>'⊃', '⊄'=>'⊄', '⊆'=>'⊆', '⊇'=>'⊇', '⊕'=>'⊕', '⊗'=>'⊗', '⊥'=>'⊥', '⋅'=>'⋅', '⌈'=>'⌈', '⌉'=>'⌉', '⌊'=>'⌊', '⌋'=>'⌋', '⟨'=>'〈', '⟩'=>'〉', '◊'=>'◊', '♠'=>'♠', '♣'=>'♣', '♥'=>'♥', '♦'=>'♦'); |
53 | $trans2 = array('''=>''', '−'=>'-', 'ˆ'=>'^', '˜'=>'~', 'Š'=>'Š', '‹'=>'‹', 'Œ'=>'Œ', '‘'=>'‘', '’'=>'’', '“'=>'“', '”'=>'”', '•'=>'•', '–'=>'–', '—'=>'—', '˜'=>'˜', '™'=>'™', 'š'=>'š', '›'=>'›', 'œ'=>'œ', 'Ÿ'=>'Ÿ', 'ÿ'=>'ÿ', 'Œ'=>'Œ', 'œ'=>'œ', 'Š'=>'Š', 'š'=>'š', 'Ÿ'=>'Ÿ', 'ƒ'=>'ƒ', 'ˆ'=>'ˆ', '˜'=>'˜', 'Α'=>'Α', 'Β'=>'Β', 'Γ'=>'Γ', 'Δ'=>'Δ', 'Ε'=>'Ε', 'Ζ'=>'Ζ', 'Η'=>'Η', 'Θ'=>'Θ', 'Ι'=>'Ι', 'Κ'=>'Κ', 'Λ'=>'Λ', 'Μ'=>'Μ', 'Ν'=>'Ν', 'Ξ'=>'Ξ', 'Ο'=>'Ο', 'Π'=>'Π', 'Ρ'=>'Ρ', 'Σ'=>'Σ', 'Τ'=>'Τ', 'Υ'=>'Υ', 'Φ'=>'Φ', 'Χ'=>'Χ', 'Ψ'=>'Ψ', 'Ω'=>'Ω', 'α'=>'α', 'β'=>'β', 'γ'=>'γ', 'δ'=>'δ', 'ε'=>'ε', 'ζ'=>'ζ', 'η'=>'η', 'θ'=>'θ', 'ι'=>'ι', 'κ'=>'κ', 'λ'=>'λ', 'μ'=>'μ', 'ν'=>'ν', 'ξ'=>'ξ', 'ο'=>'ο', 'π'=>'π', 'ρ'=>'ρ', 'ς'=>'ς', 'σ'=>'σ', 'τ'=>'τ', 'υ'=>'υ', 'φ'=>'φ', 'χ'=>'χ', 'ψ'=>'ψ', 'ω'=>'ω', 'ϑ'=>'ϑ', 'ϒ'=>'ϒ', 'ϖ'=>'ϖ', ' '=>' ', ' '=>' ', ' '=>' ', '‌'=>'‌', '‍'=>'‍', '‎'=>'‎', '‏'=>'‏', '–'=>'–', '—'=>'—', '‘'=>'‘', '’'=>'’', '‚'=>'‚', '“'=>'“', '”'=>'”', '„'=>'„', '†'=>'†', '‡'=>'‡', '•'=>'•', '…'=>'…', '‰'=>'‰', '′'=>'′', '″'=>'″', '‹'=>'‹', '›'=>'›', '‾'=>'‾', '⁄'=>'⁄', '€'=>'€', 'ℑ'=>'ℑ', '℘'=>'℘', 'ℜ'=>'ℜ', '™'=>'™', 'ℵ'=>'ℵ', '←'=>'←', '↑'=>'↑', '→'=>'→', '↓'=>'↓', '↔'=>'↔', '↵'=>'↵', '⇐'=>'⇐', '⇑'=>'⇑', '⇒'=>'⇒', '⇓'=>'⇓', '⇔'=>'⇔', '∀'=>'∀', '∂'=>'∂', '∃'=>'∃', '∅'=>'∅', '∇'=>'∇', '∈'=>'∈', '∉'=>'∉', '∋'=>'∋', '∏'=>'∏', '∑'=>'∑', '−'=>'−', '∗'=>'∗', '√'=>'√', '∝'=>'∝', '∞'=>'∞', '∠'=>'∠', '∧'=>'∧', '∨'=>'∨', '∩'=>'∩', '∪'=>'∪', '∫'=>'∫', '∴'=>'∴', '∼'=>'∼', '≅'=>'≅', '≈'=>'≈', '≠'=>'≠', '≡'=>'≡', '≤'=>'≤', '≥'=>'≥', '⊂'=>'⊂', '⊃'=>'⊃', '⊄'=>'⊄', '⊆'=>'⊆', '⊇'=>'⊇', '⊕'=>'⊕', '⊗'=>'⊗', '⊥'=>'⊥', '⋅'=>'⋅', '⌈'=>'⌈', '⌉'=>'⌉', '⌊'=>'⌊', '⌋'=>'⌋', '⟨'=>'〈', '⟩'=>'〉', '◊'=>'◊', '♠'=>'♠', '♣'=>'♣', '♥'=>'♥', '♦'=>'♦'); |
50 | $trans2 = array_flip($trans2); |
54 | $trans2 = array_flip($trans2); |
51 | foreach ($trans2 as $m1 => $m2) |
55 | foreach ($trans2 as $m1 => $m2) |
52 | { |
56 | { |
53 | // Funktioniert chr() bei den 8... Einträgen? Finde Eurozeichen nicht bei chr(8364)! |
57 | // Funktioniert chr() bei den 8... Einträgen? Finde Eurozeichen nicht bei chr(8364)! |
54 | $m1 = chr(substr($m1, 2, strlen($m1)-3)); |
58 | $m1 = chr(substr($m1, 2, strlen($m1)-3)); |
55 | 59 | ||
56 | if (($m2 != '<') && ($m2 != '>')) |
60 | if (($m2 != '<') && ($m2 != '>')) |
57 | $inp = str_replace(str_replace('&', '&', $m2), $m2, $inp); |
61 | $inp = str_replace(str_replace('&', '&', $m2), $m2, $inp); |
58 | } |
62 | } |
59 | unset($m1); |
63 | unset($m1); |
60 | unset($m2); |
64 | unset($m2); |
61 | 65 | ||
62 | return decode_critical_html_characters($inp); |
66 | return decode_critical_html_characters($inp); |
63 | } |
67 | } |
64 | 68 | ||
65 | ////////////////////////////////////////////////////////////////////////////// |
69 | ////////////////////////////////////////////////////////////////////////////// |
66 | // VERSCHLÜSSELUNGSFUNKTIONEN FÜR SESSIONS U.A. // |
70 | // VERSCHLÜSSELUNGSFUNKTIONEN FÜR SESSIONS U.A. // |
67 | ////////////////////////////////////////////////////////////////////////////// |
71 | ////////////////////////////////////////////////////////////////////////////// |
68 | 72 | ||
69 | function special_hash($string) |
73 | function special_hash($string) |
70 | { |
74 | { |
71 | $iterations = 10; |
75 | $iterations = 10; |
72 | 76 | ||
73 | $last = $string; |
77 | $last = $string; |
74 | $out = ''; |
78 | $out = ''; |
75 | for ($i=0; $i<$iterations; $i++) |
79 | for ($i=0; $i<$iterations; $i++) |
76 | { |
80 | { |
77 | $last = md5($last); |
81 | $last = md5($last); |
78 | $out .= $last; |
82 | $out .= $last; |
79 | } |
83 | } |
80 | 84 | ||
81 | $garbarge_count = 0; |
85 | $garbarge_count = 0; |
82 | for ($i=0; $i<strlen($last); $i++) |
86 | for ($i=0; $i<strlen($last); $i++) |
83 | { |
87 | { |
84 | if (($last[$i] == '0') || ($last[$i] == '1') || ($last[$i] == '2') || ($last[$i] == '3') || |
88 | if (($last[$i] == '0') || ($last[$i] == '1') || ($last[$i] == '2') || ($last[$i] == '3') || |
85 | ($last[$i] == '4') || ($last[$i] == '5') || ($last[$i] == '6') || ($last[$i] == '7') || |
89 | ($last[$i] == '4') || ($last[$i] == '5') || ($last[$i] == '6') || ($last[$i] == '7') || |
86 | ($last[$i] == '8') || ($last[$i] == '9')) |
90 | ($last[$i] == '8') || ($last[$i] == '9')) |
87 | { |
91 | { |
88 | $garbarge_count = $garbarge_count + $last[$i]; |
92 | $garbarge_count = $garbarge_count + $last[$i]; |
89 | } |
93 | } |
90 | } |
94 | } |
91 | 95 | ||
92 | for ($i=0; $i<=$garbarge_count; $i++) |
96 | for ($i=0; $i<=$garbarge_count; $i++) |
93 | { |
97 | { |
94 | $out = $last[0].$out.$last[1]; |
98 | $out = $last[0].$out.$last[1]; |
95 | } |
99 | } |
96 | 100 | ||
97 | if (strlen($out) > 1024) $out = substr($out, 0, 1024); |
101 | if (strlen($out) > 1024) $out = substr($out, 0, 1024); |
98 | 102 | ||
99 | return $out; |
103 | return $out; |
100 | } |
104 | } |
101 | 105 | ||
102 | function get_rnd_iv($iv_len) |
106 | function get_rnd_iv($iv_len) |
103 | { |
107 | { |
104 | $iv = ''; |
108 | $iv = ''; |
105 | while ($iv_len-- > 0) { |
109 | while ($iv_len-- > 0) { |
106 | $iv .= chr(mt_rand() & 0xff); |
110 | $iv .= chr(mt_rand() & 0xff); |
107 | } |
111 | } |
108 | return $iv; |
112 | return $iv; |
109 | } |
113 | } |
110 | 114 | ||
111 | function md5_encrypt($plain_text, $password, $iv_len = 16) |
115 | function md5_encrypt($plain_text, $password, $iv_len = 16) |
112 | { |
116 | { |
113 | $plain_text .= "\x13"; |
117 | $plain_text .= "\x13"; |
114 | $n = strlen($plain_text); |
118 | $n = strlen($plain_text); |
115 | if ($n % 16) $plain_text .= str_repeat("\0", 16 - ($n % 16)); |
119 | if ($n % 16) $plain_text .= str_repeat("\0", 16 - ($n % 16)); |
116 | $i = 0; |
120 | $i = 0; |
117 | $enc_text = get_rnd_iv($iv_len); |
121 | $enc_text = get_rnd_iv($iv_len); |
118 | $iv = substr($password ^ $enc_text, 0, 512); |
122 | $iv = substr($password ^ $enc_text, 0, 512); |
119 | while ($i < $n) { |
123 | while ($i < $n) { |
120 | $block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv)); |
124 | $block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv)); |
121 | $enc_text .= $block; |
125 | $enc_text .= $block; |
122 | $iv = substr($block . $iv, 0, 512) ^ $password; |
126 | $iv = substr($block . $iv, 0, 512) ^ $password; |
123 | $i += 16; |
127 | $i += 16; |
124 | } |
128 | } |
125 | return base64_encode($enc_text); |
129 | return base64_encode($enc_text); |
126 | } |
130 | } |
127 | 131 | ||
128 | function md5_decrypt($enc_text, $password, $iv_len = 16) |
132 | function md5_decrypt($enc_text, $password, $iv_len = 16) |
129 | { |
133 | { |
130 | $enc_text = base64_decode($enc_text); |
134 | $enc_text = base64_decode($enc_text); |
131 | $n = strlen($enc_text); |
135 | $n = strlen($enc_text); |
132 | $i = $iv_len; |
136 | $i = $iv_len; |
133 | $plain_text = ''; |
137 | $plain_text = ''; |
134 | $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512); |
138 | $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512); |
135 | while ($i < $n) { |
139 | while ($i < $n) { |
136 | $block = substr($enc_text, $i, 16); |
140 | $block = substr($enc_text, $i, 16); |
137 | $plain_text .= $block ^ pack('H*', md5($iv)); |
141 | $plain_text .= $block ^ pack('H*', md5($iv)); |
138 | $iv = substr($block . $iv, 0, 512) ^ $password; |
142 | $iv = substr($block . $iv, 0, 512) ^ $password; |
139 | $i += 16; |
143 | $i += 16; |
140 | } |
144 | } |
141 | return preg_replace('/\\x13\\x00*$/', '', $plain_text); |
145 | return preg_replace('/\\x13\\x00*$/', '', $plain_text); |
142 | } |
146 | } |
143 | 147 | ||
144 | function wb_encrypt($message, $key) |
148 | function wb_encrypt($message, $key) |
145 | { |
149 | { |
146 | return md5_encrypt($message, $key); |
150 | return md5_encrypt($message, $key); |
147 | } |
151 | } |
148 | 152 | ||
149 | function wb_decrypt($message, $key) |
153 | function wb_decrypt($message, $key) |
150 | { |
154 | { |
151 | return md5_decrypt($message, $key); |
155 | return md5_decrypt($message, $key); |
152 | } |
156 | } |
153 | 157 | ||
154 | ////////////////////////////////////////////////////////////////////////////// |
158 | ////////////////////////////////////////////////////////////////////////////// |
155 | // NÜTZLICHE FUNKTIONEN // |
159 | // NÜTZLICHE FUNKTIONEN // |
156 | ////////////////////////////////////////////////////////////////////////////// |
160 | ////////////////////////////////////////////////////////////////////////////// |
157 | 161 | ||
158 | function WBUserAgent() { |
162 | function WBUserAgent() { |
159 | global $WBConfig; |
163 | global $WBConfig; |
160 | return 'ViaThinkSoft Personal WebBase '.$WBConfig->getRevision().' (PHP/'.phpversion().')'; |
164 | return 'ViaThinkSoft Personal WebBase '.$WBConfig->getRevision().' (PHP/'.phpversion().')'; |
161 | } |
165 | } |
162 | 166 | ||
163 | // Anmerkung: Subdomains sind nicht gültig. |
167 | // Anmerkung: Subdomains sind nicht gültig. |
164 | 168 | ||
165 | // @param $name Name des Cookies |
169 | // @param $name Name des Cookies |
166 | // @value $value Wert des Cookies |
170 | // @value $value Wert des Cookies |
167 | // @param $time 0 für "Ende der Sitzung" oder Sekundenanzahl als Gültigkeit |
171 | // @param $time 0 für "Ende der Sitzung" oder Sekundenanzahl als Gültigkeit |
168 | function wbSetCookie($name, $value, $time) { |
172 | function wbSetCookie($name, $value, $time) { |
169 | global $WBConfig; |
173 | global $WBConfig; |
170 | if ($time != 0) $time += time(); |
174 | if ($time != 0) $time += time(); |
171 | setCookie($name, $value, $time, RELATIVE_DIR, /* $_SERVER['HTTP_HOST'] */ '', $WBConfig->getForceSSLFlag()); |
175 | setCookie($name, $value, $time, RELATIVE_DIR, /* $_SERVER['HTTP_HOST'] */ '', $WBConfig->getForceSSLFlag()); |
172 | } |
176 | } |
173 | 177 | ||
174 | // @param $name |
178 | // @param $name |
175 | // @param $wb_rel_path Path relative to the WebBase directory (for third-party systems!) |
179 | // @param $wb_rel_path Path relative to the WebBase directory (for third-party systems!) |
176 | function wbUnsetCookie($name, $wb_rel_path = '') { |
180 | function wbUnsetCookie($name, $wb_rel_path = '') { |
177 | global $WBConfig; |
181 | global $WBConfig; |
178 | setCookie($name, '', -1, RELATIVE_DIR.$wb_rel_path, /* $_SERVER['HTTP_HOST'] */ '', $WBConfig->getForceSSLFlag()); |
182 | setCookie($name, '', -1, RELATIVE_DIR.$wb_rel_path, /* $_SERVER['HTTP_HOST'] */ '', $WBConfig->getForceSSLFlag()); |
179 | } |
183 | } |
180 | 184 | ||
181 | // TODO (Prüfen) |
185 | // TODO (Prüfen) |
182 | // Das Argument von deferer() sollte aufgrund der W3C-Konformität & statt & enthalten |
186 | // Das Argument von deferer() sollte aufgrund der W3C-Konformität & statt & enthalten |
183 | 187 | ||
184 | function deferer($url) { |
188 | function deferer($url) { |
185 | return 'deferer.php?target='.urlencode($url); |
189 | return 'deferer.php?target='.urlencode($url); |
186 | } |
190 | } |
187 | 191 | ||
188 | function ip_tracer($ip) { |
192 | function ip_tracer($ip) { |
189 | return deferer('http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext='.$ip.'&submit.x=0&submit.y=0'); |
193 | return deferer('http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext='.$ip.'&submit.x=0&submit.y=0'); |
190 | } |
194 | } |
191 | 195 | ||
192 | function url_protokoll_vorhanden($url) |
196 | function url_protokoll_vorhanden($url) |
193 | { |
197 | { |
194 | $ary = explode('://', $url); |
198 | $ary = explode('://', $url); |
195 | return ((strpos($ary[0], '/') === false) && (isset($ary[1]))); |
199 | return ((strpos($ary[0], '/') === false) && (isset($ary[1]))); |
196 | } |
200 | } |
197 | 201 | ||
198 | function wb_redirect_now($url) { |
202 | function wb_redirect_now($url) { |
199 | 203 | ||
200 | if (url_protokoll_vorhanden($url)) { |
204 | if (url_protokoll_vorhanden($url)) { |
201 | // Umwechseln von HTTP<->HTTPS ist bei gleicher Adresse ohne Deferrer erlaubt |
205 | // Umwechseln von HTTP<->HTTPS ist bei gleicher Adresse ohne Deferrer erlaubt |
202 | if ((str_replace('https://', '', $url) != $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) && |
206 | if ((str_replace('https://', '', $url) != $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']) && |
203 | (str_replace('http://', '', $url) != $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) |
207 | (str_replace('http://', '', $url) != $_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'])) |
204 | { |
208 | { |
205 | $url = deferer($url); // Umleitung auf eine externe Seite |
209 | $url = deferer($url); // Umleitung auf eine externe Seite |
206 | } |
210 | } |
207 | } |
211 | } |
208 | 212 | ||
209 | if (!headers_sent()) { |
213 | if (!headers_sent()) { |
210 | header('Location: '.$url); |
214 | header('Location: '.$url); |
211 | } else { |
215 | } else { |
212 | // HTML-Weiterleitung |
216 | // HTML-Weiterleitung |
213 | echo 'Redirect: <a href="'.$url.'">'.$url.'</a><br>'."\r\n\r\n"; |
217 | echo 'Redirect: <a href="'.$url.'">'.$url.'</a><br>'."\r\n\r\n"; |
214 | echo '<script language ="JavaScript"> |
218 | echo '<script language ="JavaScript"> |
215 | <!-- |
219 | <!-- |
216 | window.location.replace("'.$url.'"); |
220 | window.location.replace("'.$url.'"); |
217 | // --> |
221 | // --> |
218 | </script>'; |
222 | </script>'; |
219 | } |
223 | } |
220 | 224 | ||
221 | die(''); |
225 | die(''); |
222 | } |
226 | } |
223 | 227 | ||
224 | function add_trailing_path_delimiter($url_or_directory) { |
228 | function add_trailing_path_delimiter($url_or_directory) { |
225 | if (substr($url_or_directory, strlen($url_or_directory)-1, 1) != '/') { |
229 | if (substr($url_or_directory, strlen($url_or_directory)-1, 1) != '/') { |
226 | $url_or_directory .= '/'; |
230 | $url_or_directory .= '/'; |
227 | } |
231 | } |
228 | return $url_or_directory; |
232 | return $url_or_directory; |
229 | } |
233 | } |
230 | 234 | ||
231 | function dirname_with_pathdelimiter($directory) |
235 | function dirname_with_pathdelimiter($directory) |
232 | { |
236 | { |
233 | $tmp = dirname($directory); |
237 | $tmp = dirname($directory); |
234 | $tmp = str_replace('\\', '/', $tmp); |
238 | $tmp = str_replace('\\', '/', $tmp); |
235 | $tmp = add_trailing_path_delimiter($tmp); |
239 | $tmp = add_trailing_path_delimiter($tmp); |
236 | return $tmp; |
240 | return $tmp; |
237 | } |
241 | } |
238 | 242 | ||
239 | function string2hex($str) |
243 | function string2hex($str) |
240 | { |
244 | { |
241 | if (trim($str) != "") |
245 | if (trim($str) != "") |
242 | { |
246 | { |
243 | $hex = ""; |
247 | $hex = ""; |
244 | $length = strlen($str); |
248 | $length = strlen($str); |
245 | for ($i=0; $i<$length; $i++) |
249 | for ($i=0; $i<$length; $i++) |
246 | { |
250 | { |
247 | $hex .= str_pad(dechex(ord($str[$i])), 2, 0, STR_PAD_LEFT); |
251 | $hex .= str_pad(dechex(ord($str[$i])), 2, 0, STR_PAD_LEFT); |
248 | } |
252 | } |
249 | return $hex; |
253 | return $hex; |
250 | } |
254 | } |
251 | } |
255 | } |
252 | 256 | ||
253 | function hex2string($hex) |
257 | function hex2string($hex) |
254 | { |
258 | { |
255 | $string = ''; |
259 | $string = ''; |
256 | 260 | ||
257 | $hex = str_replace(array("\n","\r"," "), "", $hex); |
261 | $hex = str_replace(array("\n","\r"," "), "", $hex); |
258 | 262 | ||
259 | for ($ix=0; $ix < strlen($hex); $ix=$ix+2) |
263 | for ($ix=0; $ix < strlen($hex); $ix=$ix+2) |
260 | { |
264 | { |
261 | $ord = hexdec(substr($hex, $ix, 2)); |
265 | $ord = hexdec(substr($hex, $ix, 2)); |
262 | $string .= chr($ord); |
266 | $string .= chr($ord); |
263 | } |
267 | } |
264 | 268 | ||
265 | return $string; |
269 | return $string; |
266 | } |
270 | } |
267 | 271 | ||
268 | // http://lists.phpbar.de/pipermail/php/Week-of-Mon-20040322/007749.html |
272 | // http://lists.phpbar.de/pipermail/php/Week-of-Mon-20040322/007749.html |
269 | 273 | ||
270 | function fetchip() |
274 | function fetchip() |
271 | { |
275 | { |
272 | $client_ip = (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : ''; |
276 | $client_ip = (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : ''; |
273 | $x_forwarded_for = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ''; |
277 | $x_forwarded_for = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : ''; |
274 | $remote_addr = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : ''; |
278 | $remote_addr = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : ''; |
275 | 279 | ||
276 | if (!empty($client_ip)) |
280 | if (!empty($client_ip)) |
277 | { |
281 | { |
278 | $ip_expl = explode('.',$client_ip); |
282 | $ip_expl = explode('.',$client_ip); |
279 | $referer = explode('.',$remote_addr); |
283 | $referer = explode('.',$remote_addr); |
280 | if($referer[0] != $ip_expl[0]) |
284 | if($referer[0] != $ip_expl[0]) |
281 | { |
285 | { |
282 | $ip=array_reverse($ip_expl); |
286 | $ip=array_reverse($ip_expl); |
283 | $return=implode('.',$ip); |
287 | $return=implode('.',$ip); |
284 | } |
288 | } |
285 | else |
289 | else |
286 | { |
290 | { |
287 | $return = $client_ip; |
291 | $return = $client_ip; |
288 | } |
292 | } |
289 | } |
293 | } |
290 | else if (!empty($x_forwarded_for)) |
294 | else if (!empty($x_forwarded_for)) |
291 | { |
295 | { |
292 | if(strstr($x_forwarded_for,',')) |
296 | if(strstr($x_forwarded_for,',')) |
293 | { |
297 | { |
294 | $ip_expl = explode(',',$x_forwarded_for); |
298 | $ip_expl = explode(',',$x_forwarded_for); |
295 | $return = end($ip_expl); |
299 | $return = end($ip_expl); |
296 | } |
300 | } |
297 | else |
301 | else |
298 | { |
302 | { |
299 | $return = $x_forwarded_for; |
303 | $return = $x_forwarded_for; |
300 | } |
304 | } |
301 | } |
305 | } |
302 | else |
306 | else |
303 | { |
307 | { |
304 | $return = $remote_addr; |
308 | $return = $remote_addr; |
305 | } |
309 | } |
306 | unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl); |
310 | unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl); |
307 | return $return; |
311 | return $return; |
308 | } |
312 | } |
309 | 313 | ||
310 | function my_htmlentities($inp, $charset = 'utf-8') |
314 | function my_wb_htmlentities($inp, $charset = 'utf-8') |
311 | { |
315 | { |
312 | // http://www.php.net/manual/de/function.htmlspecialchars.php |
316 | // http://www.php.net/manual/de/function.htmlspecialchars.php |
313 | // PHP-Version wird nicht kontrolliert... |
317 | // PHP-Version wird nicht kontrolliert... |
314 | $cs = 'utf-8'; |
318 | $cs = 'utf-8'; |
315 | 319 | ||
316 | if (strtolower($charset) == 'iso-8859-1') $cs = 'ISO-8859-1'; |
320 | if (strtolower($charset) == 'iso-8859-1') $cs = 'ISO-8859-1'; |
317 | if (strtolower($charset) == 'iso8859-1') $cs = 'ISO-8859-1'; |
321 | if (strtolower($charset) == 'iso8859-1') $cs = 'ISO-8859-1'; |
318 | if (strtolower($charset) == 'iso-8859-15') $cs = 'ISO-8859-15'; |
322 | if (strtolower($charset) == 'iso-8859-15') $cs = 'ISO-8859-15'; |
319 | if (strtolower($charset) == 'iso8859-15') $cs = 'ISO-8859-15'; |
323 | if (strtolower($charset) == 'iso8859-15') $cs = 'ISO-8859-15'; |
320 | if (strtolower($charset) == 'utf-8') $cs = 'UTF-8'; |
324 | if (strtolower($charset) == 'utf-8') $cs = 'UTF-8'; |
321 | if (strtolower($charset) == 'cp866') $cs = 'cp866'; |
325 | if (strtolower($charset) == 'cp866') $cs = 'cp866'; |
322 | if (strtolower($charset) == 'ibm866') $cs = 'cp866'; |
326 | if (strtolower($charset) == 'ibm866') $cs = 'cp866'; |
323 | if (strtolower($charset) == '866') $cs = 'cp866'; |
327 | if (strtolower($charset) == '866') $cs = 'cp866'; |
324 | if (strtolower($charset) == 'cp1251') $cs = 'cp1251'; |
328 | if (strtolower($charset) == 'cp1251') $cs = 'cp1251'; |
325 | if (strtolower($charset) == 'windows-1251') $cs = 'cp1251'; |
329 | if (strtolower($charset) == 'windows-1251') $cs = 'cp1251'; |
326 | if (strtolower($charset) == 'win-1251') $cs = 'cp1251'; |
330 | if (strtolower($charset) == 'win-1251') $cs = 'cp1251'; |
327 | if (strtolower($charset) == '1251') $cs = 'cp1251'; |
331 | if (strtolower($charset) == '1251') $cs = 'cp1251'; |
328 | if (strtolower($charset) == 'cp1252') $cs = 'cp1252'; |
332 | if (strtolower($charset) == 'cp1252') $cs = 'cp1252'; |
329 | if (strtolower($charset) == 'windows-1252') $cs = 'cp1252'; |
333 | if (strtolower($charset) == 'windows-1252') $cs = 'cp1252'; |
330 | if (strtolower($charset) == '1252') $cs = 'cp1252'; |
334 | if (strtolower($charset) == '1252') $cs = 'cp1252'; |
331 | if (strtolower($charset) == 'koi8-r') $cs = 'KOI8-R'; |
335 | if (strtolower($charset) == 'koi8-r') $cs = 'KOI8-R'; |
332 | if (strtolower($charset) == 'koi8-ru') $cs = 'KOI8-R'; |
336 | if (strtolower($charset) == 'koi8-ru') $cs = 'KOI8-R'; |
333 | if (strtolower($charset) == 'koi8r') $cs = 'KOI8-R'; |
337 | if (strtolower($charset) == 'koi8r') $cs = 'KOI8-R'; |
334 | if (strtolower($charset) == 'big5') $cs = 'BIG5'; |
338 | if (strtolower($charset) == 'big5') $cs = 'BIG5'; |
335 | if (strtolower($charset) == '950') $cs = 'BIG5'; |
339 | if (strtolower($charset) == '950') $cs = 'BIG5'; |
336 | if (strtolower($charset) == 'gb2312') $cs = 'GB2312'; |
340 | if (strtolower($charset) == 'gb2312') $cs = 'GB2312'; |
337 | if (strtolower($charset) == '936') $cs = 'GB2312'; |
341 | if (strtolower($charset) == '936') $cs = 'GB2312'; |
338 | if (strtolower($charset) == 'big5-hkscs') $cs = 'BIG5-HKSCS'; |
342 | if (strtolower($charset) == 'big5-hkscs') $cs = 'BIG5-HKSCS'; |
339 | if (strtolower($charset) == 'shift_jis') $cs = 'Shift_JIS'; |
343 | if (strtolower($charset) == 'shift_jis') $cs = 'Shift_JIS'; |
340 | if (strtolower($charset) == 'sjis') $cs = 'Shift_JIS'; |
344 | if (strtolower($charset) == 'sjis') $cs = 'Shift_JIS'; |
341 | if (strtolower($charset) == '932') $cs = 'Shift_JIS'; |
345 | if (strtolower($charset) == '932') $cs = 'Shift_JIS'; |
342 | if (strtolower($charset) == 'euc-jp') $cs = 'EUC-JP'; |
346 | if (strtolower($charset) == 'euc-jp') $cs = 'EUC-JP'; |
343 | if (strtolower($charset) == 'eucjp') $cs = 'EUC-JP'; |
347 | if (strtolower($charset) == 'eucjp') $cs = 'EUC-JP'; |
344 | 348 | ||
345 | return @htmlentities($inp, ENT_NOQUOTES, $cs); |
349 | return @wb_htmlentities($inp, ENT_NOQUOTES, $cs); |
346 | } |
350 | } |
347 | 351 | ||
348 | function check_email($email_adresse) |
352 | function check_email($email_adresse) |
349 | { |
353 | { |
350 | if(eregi("^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$",$email_adresse)) |
354 | if(preg_match("|^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$|ismU",$email_adresse)) |
351 | return true; |
355 | return true; |
352 | else |
356 | else |
353 | return false; |
357 | return false; |
354 | } |
358 | } |
355 | 359 | ||
356 | function return_bytes($val) |
360 | function return_bytes($val) |
357 | { |
361 | { |
358 | $val = trim($val); |
362 | $val = trim($val); |
359 | $last = strtolower($val{strlen($val)-1}); |
363 | $last = strtolower($val{strlen($val)-1}); |
360 | switch($last) |
364 | switch($last) |
361 | { |
365 | { |
362 | case 'g': |
366 | case 'g': |
363 | $val *= 1024; |
367 | $val *= 1024; |
364 | case 'm': |
368 | case 'm': |
365 | $val *= 1024; |
369 | $val *= 1024; |
366 | case 'k': |
370 | case 'k': |
367 | $val *= 1024; |
371 | $val *= 1024; |
368 | } |
372 | } |
369 | return $val; |
373 | return $val; |
370 | } |
374 | } |
371 | 375 | ||
372 | function zufall($size) |
376 | function zufall($size) |
373 | { |
377 | { |
374 | $result = ""; |
378 | $result = ""; |
375 | 379 | ||
376 | srand((double)microtime()*1000000); |
380 | srand((double)microtime()*1000000); |
377 | 381 | ||
378 | for($i=0; $i < $size; $i++) |
382 | for($i=0; $i < $size; $i++) |
379 | { |
383 | { |
380 | $num = rand(48,120); |
384 | $num = rand(48,120); |
381 | while (($num >= 58 && $num <= 64) || ($num >= 91 && $num <= 96)) |
385 | while (($num >= 58 && $num <= 64) || ($num >= 91 && $num <= 96)) |
382 | $num = rand(48,120); |
386 | $num = rand(48,120); |
383 | 387 | ||
384 | $result .= chr($num); |
388 | $result .= chr($num); |
385 | } |
389 | } |
386 | return $result; |
390 | return $result; |
387 | } |
391 | } |
388 | 392 | ||
389 | function runden($inp, $nachkommastellen = 0) |
393 | function runden($inp, $nachkommastellen = 0) |
390 | { |
394 | { |
391 | return number_format($inp, $nachkommastellen, ",", "."); |
395 | return number_format($inp, $nachkommastellen, ",", "."); |
392 | } |
396 | } |
393 | 397 | ||
394 | function dir_add_trailing_backslash($directory) { |
398 | function dir_add_trailing_backslash($directory) { |
395 | if (substr($directory, strlen($directory)-1, 1) != '/') $directory .= '/'; |
399 | if (substr($directory, strlen($directory)-1, 1) != '/') $directory .= '/'; |
396 | return $directory; |
400 | return $directory; |
397 | } |
401 | } |
398 | 402 | ||
399 | // PHP-AntiSpam-Funktion "secure_email", Version 3.0 |
403 | // PHP-AntiSpam-Funktion "secure_email", Version 3.0 |
400 | // von Daniel Marschall [www.daniel-marschall.de] |
404 | // von Daniel Marschall [www.daniel-marschall.de] |
401 | 405 | ||
402 | function secure_email($email, $linktext, $crypt_linktext) |
406 | function secure_email($email, $linktext, $crypt_linktext) |
403 | { |
407 | { |
404 | if (!function_exists('alas_js_crypt')) |
408 | if (!function_exists('alas_js_crypt')) |
405 | { |
409 | { |
406 | function alas_js_crypt($text) |
410 | function alas_js_crypt($text) |
407 | { |
411 | { |
408 | $tmp = ''; |
412 | $tmp = ''; |
409 | for ($i=0; $i<strlen($text); $i++) |
413 | for ($i=0; $i<strlen($text); $i++) |
410 | { |
414 | { |
411 | $tmp .= 'document.write("&#'.ord(substr($text, $i, 1)).';");'; |
415 | $tmp .= 'document.write("&#'.ord(substr($text, $i, 1)).';");'; |
412 | } |
416 | } |
413 | return $tmp; |
417 | return $tmp; |
414 | } |
418 | } |
415 | } |
419 | } |
416 | 420 | ||
417 | if (!function_exists('alas_js_write')) |
421 | if (!function_exists('alas_js_write')) |
418 | { |
422 | { |
419 | function alas_js_write($text) |
423 | function alas_js_write($text) |
420 | { |
424 | { |
421 | $text = str_replace('\\', '\\\\', $text); |
425 | $text = str_replace('\\', '\\\\', $text); |
422 | $text = str_replace('"', '\"', $text); |
426 | $text = str_replace('"', '\"', $text); |
423 | $text = str_replace('/', '\/', $text); // W3C Validation </a> -> <\/a> |
427 | $text = str_replace('/', '\/', $text); // W3C Validation </a> -> <\/a> |
424 | return 'document.write("'.$text.'");'; |
428 | return 'document.write("'.$text.'");'; |
425 | } |
429 | } |
426 | } |
430 | } |
427 | 431 | ||
428 | $aus = ''; |
432 | $aus = ''; |
429 | if ($email != '') |
433 | if ($email != '') |
430 | { |
434 | { |
431 | $aus .= '<script language="JavaScript" type="text/javascript"><!--'."\n"; |
435 | $aus .= '<script language="JavaScript" type="text/javascript"><!--'."\n"; |
432 | $aus .= alas_js_write('<a href="'); |
436 | $aus .= alas_js_write('<a href="'); |
433 | $aus .= alas_js_crypt('mailto:'.$email); |
437 | $aus .= alas_js_crypt('mailto:'.$email); |
434 | $aus .= alas_js_write('">'); |
438 | $aus .= alas_js_write('">'); |
435 | $aus .= $crypt_linktext ? alas_js_crypt($linktext) : alas_js_write($linktext); |
439 | $aus .= $crypt_linktext ? alas_js_crypt($linktext) : alas_js_write($linktext); |
436 | $aus .= alas_js_write('</a>').'// --></script>'; |
440 | $aus .= alas_js_write('</a>').'// --></script>'; |
437 | } |
441 | } |
438 | return $aus; |
442 | return $aus; |
439 | } |
443 | } |
440 | 444 | ||
441 | function de_convertmysqldatetime($datum, $zeige_sekunden = false) |
445 | function de_convertmysqldatetime($datum, $zeige_sekunden = false) |
442 | { |
446 | { |
443 | if (($datum == '') || ($datum == '0000-00-00 00:00:00')) |
447 | if (($datum == '') || ($datum == '0000-00-00 00:00:00')) |
444 | { |
448 | { |
445 | return 'Unbekannt'; |
449 | return 'Unbekannt'; |
446 | } |
450 | } |
447 | else |
451 | else |
448 | { |
452 | { |
449 | 453 | ||
450 | $date = explode(" ", $datum); |
454 | $date = explode(" ", $datum); |
451 | $ddatum = explode("-", $date[0]); |
455 | $ddatum = explode("-", $date[0]); |
452 | if (isset($date[1])) |
456 | if (isset($date[1])) |
453 | { |
457 | { |
454 | $date = explode(":", $date[1]); |
458 | $date = explode(":", $date[1]); |
455 | } |
459 | } |
456 | else |
460 | else |
457 | { |
461 | { |
458 | $date[0] = ''; |
462 | $date[0] = ''; |
459 | $date[1] = ''; |
463 | $date[1] = ''; |
460 | $date[2] = ''; |
464 | $date[2] = ''; |
461 | } |
465 | } |
462 | 466 | ||
463 | if ($ddatum[1] == '01') $mon = 'Januar'; |
467 | if ($ddatum[1] == '01') $mon = 'Januar'; |
464 | if ($ddatum[1] == '02') $mon = 'Februar'; |
468 | if ($ddatum[1] == '02') $mon = 'Februar'; |
465 | if ($ddatum[1] == '03') $mon = 'März'; |
469 | if ($ddatum[1] == '03') $mon = 'März'; |
466 | if ($ddatum[1] == '04') $mon = 'April'; |
470 | if ($ddatum[1] == '04') $mon = 'April'; |
467 | if ($ddatum[1] == '05') $mon = 'Mai'; |
471 | if ($ddatum[1] == '05') $mon = 'Mai'; |
468 | if ($ddatum[1] == '06') $mon = 'Juni'; |
472 | if ($ddatum[1] == '06') $mon = 'Juni'; |
469 | if ($ddatum[1] == '07') $mon = 'Juli'; |
473 | if ($ddatum[1] == '07') $mon = 'Juli'; |
470 | if ($ddatum[1] == '08') $mon = 'August'; |
474 | if ($ddatum[1] == '08') $mon = 'August'; |
471 | if ($ddatum[1] == '09') $mon = 'September'; |
475 | if ($ddatum[1] == '09') $mon = 'September'; |
472 | if ($ddatum[1] == '10') $mon = 'Oktober'; |
476 | if ($ddatum[1] == '10') $mon = 'Oktober'; |
473 | if ($ddatum[1] == '11') $mon = 'November'; |
477 | if ($ddatum[1] == '11') $mon = 'November'; |
474 | if ($ddatum[1] == '12') $mon = 'Dezember'; |
478 | if ($ddatum[1] == '12') $mon = 'Dezember'; |
475 | $tag = sprintf("%d",$ddatum[2]); |
479 | $tag = sprintf("%d",$ddatum[2]); |
476 | $datum = $tag.". ".$mon." ".$ddatum[0]; |
480 | $datum = $tag.". ".$mon." ".$ddatum[0]; |
477 | 481 | ||
478 | if (($date[0] != '') && ($date[1] != '')) |
482 | if (($date[0] != '') && ($date[1] != '')) |
479 | { |
483 | { |
480 | if ($zeige_sekunden) $zus = ':'.$date[2]; else $zus = ''; |
484 | if ($zeige_sekunden) $zus = ':'.$date[2]; else $zus = ''; |
481 | return $datum.', '.$date[0].':'.$date[1].$zus.' Uhr'; |
485 | return $datum.', '.$date[0].':'.$date[1].$zus.' Uhr'; |
482 | } |
486 | } |
483 | else |
487 | else |
484 | return $datum; |
488 | return $datum; |
485 | } |
489 | } |
486 | } |
490 | } |
487 | 491 | ||
488 | function zwischen_str($str, $von, $bis, $flankierungen_miteinbeziehen = true) |
492 | function zwischen_str($str, $von, $bis, $flankierungen_miteinbeziehen = true) |
489 | { |
493 | { |
490 | $ausgabe = $str; |
494 | $ausgabe = $str; |
491 | 495 | ||
492 | if ($von != '') |
496 | if ($von != '') |
493 | { |
497 | { |
494 | $pos = strpos($ausgabe, $von); |
498 | $pos = strpos($ausgabe, $von); |
495 | if ($pos !== false) |
499 | if ($pos !== false) |
496 | { |
500 | { |
497 | $ausgabe = substr($ausgabe, $pos, strlen($ausgabe)-$pos); |
501 | $ausgabe = substr($ausgabe, $pos, strlen($ausgabe)-$pos); |
498 | if (!$flankierungen_miteinbeziehen) |
502 | if (!$flankierungen_miteinbeziehen) |
499 | $ausgabe = substr($ausgabe, strlen($von), strlen($ausgabe)-strlen($von)-1); // -1 ? |
503 | $ausgabe = substr($ausgabe, strlen($von), strlen($ausgabe)-strlen($von)-1); // -1 ? |
500 | } |
504 | } |
501 | } |
505 | } |
502 | 506 | ||
503 | if ($bis != '') |
507 | if ($bis != '') |
504 | { |
508 | { |
505 | $pos = strpos($ausgabe, $bis); |
509 | $pos = strpos($ausgabe, $bis); |
506 | if ($pos !== false) |
510 | if ($pos !== false) |
507 | { |
511 | { |
508 | $ausgabe = substr($ausgabe, 0, $pos+strlen($bis)); |
512 | $ausgabe = substr($ausgabe, 0, $pos+strlen($bis)); |
509 | if (!$flankierungen_miteinbeziehen) |
513 | if (!$flankierungen_miteinbeziehen) |
510 | $ausgabe = substr($ausgabe, 0, strlen($ausgabe)-strlen($bis)); |
514 | $ausgabe = substr($ausgabe, 0, strlen($ausgabe)-strlen($bis)); |
511 | } |
515 | } |
512 | } |
516 | } |
513 | 517 | ||
514 | return $ausgabe; |
518 | return $ausgabe; |
515 | } |
519 | } |
516 | 520 | ||
517 | ////////////////////////////////////////////////////////////////////////////// |
521 | ////////////////////////////////////////////////////////////////////////////// |
518 | // GFX/LISTE/OOP-FUNKTIONEN // |
522 | // GFX/LISTE/OOP-FUNKTIONEN // |
519 | ////////////////////////////////////////////////////////////////////////////// |
523 | ////////////////////////////////////////////////////////////////////////////// |
520 | 524 | ||
521 | function oop_link_to_modul($modul, $seite = 'main', $titelzeile_modul = '') |
525 | function oop_link_to_modul($modul, $seite = 'main', $titelzeile_modul = '') |
522 | { |
526 | { |
523 | if ($titelzeile_modul == '') $titelzeile_modul = $modul; |
527 | if ($titelzeile_modul == '') $titelzeile_modul = $modul; |
524 | 528 | ||
525 | $module_information = WBModuleHandler::get_module_information($titelzeile_modul); |
529 | $module_information = WBModuleHandler::get_module_information($titelzeile_modul); |
526 | 530 | ||
527 | if (file_exists('modules/'.$titelzeile_modul.'/images/menu/32.gif')) |
531 | if (file_exists('modules/'.$titelzeile_modul.'/images/menu/32.gif')) |
528 | $g = 'modules/'.$titelzeile_modul.'/images/menu/32.gif'; |
532 | $g = 'modules/'.$titelzeile_modul.'/images/menu/32.gif'; |
529 | else if (file_exists('modules/'.$titelzeile_modul.'/images/menu/32.png')) |
533 | else if (file_exists('modules/'.$titelzeile_modul.'/images/menu/32.png')) |
530 | $g = 'modules/'.$titelzeile_modul.'/images/menu/32.png'; |
534 | $g = 'modules/'.$titelzeile_modul.'/images/menu/32.png'; |
531 | else |
535 | else |
532 | $g = 'designs/spacer.gif'; |
536 | $g = 'designs/spacer.gif'; |
533 | 537 | ||
534 | return "javascript:oop('".$modul."', '".$seite."', '".htmlentities($module_information->caption)."', '".$g."');"; |
538 | return "javascript:oop('".$modul."', '".$seite."', '".wb_htmlentities($module_information->caption)."', '".$g."');"; |
535 | } |
539 | } |
536 | 540 | ||
537 | function wb_list_items($modul, $table, $append, $dir = 0) |
541 | function wb_list_items($modul, $table, $append, $dir = 0) |
538 | { |
542 | { |
539 | global $benutzer; |
543 | global $benutzer; |
540 | 544 | ||
541 | if (!isset($erg)) $erg = array(); |
545 | if (!isset($erg)) $erg = array(); |
542 | 546 | ||
543 | $i = 0; |
547 | $i = 0; |
544 | $res = db_query("SELECT * FROM `$table` WHERE `folder_cnid` = '".db_escape($dir)."' AND `user_cnid` = '".$benutzer['id']."' $append"); |
548 | $res = db_query("SELECT * FROM `$table` WHERE `folder_cnid` = '".db_escape($dir)."' AND `user_cnid` = '".$benutzer['id']."' $append"); |
545 | while ($row = db_fetch($res)) |
549 | while ($row = db_fetch($res)) |
546 | { |
550 | { |
547 | $i++; |
551 | $i++; |
548 | $erg[$i] = $row; |
552 | $erg[$i] = $row; |
549 | } |
553 | } |
550 | 554 | ||
551 | return $erg; |
555 | return $erg; |
552 | } |
556 | } |
553 | 557 | ||
554 | function wb_list_items_filter($modul, $table, $append) |
558 | function wb_list_items_filter($modul, $table, $append) |
555 | { |
559 | { |
556 | $i = 0; |
560 | $i = 0; |
557 | 561 | ||
558 | $res = db_query("SELECT * FROM `$table` $append"); |
562 | $res = db_query("SELECT * FROM `$table` $append"); |
559 | while ($row = db_fetch($res)) |
563 | while ($row = db_fetch($res)) |
560 | { |
564 | { |
561 | $i++; |
565 | $i++; |
562 | $erg[$i] = $row; |
566 | $erg[$i] = $row; |
563 | } |
567 | } |
564 | 568 | ||
565 | return $erg; |
569 | return $erg; |
566 | } |
570 | } |
567 | 571 | ||
568 | function wb_draw_table_begin() |
572 | function wb_draw_table_begin() |
569 | { |
573 | { |
570 | echo '<div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%">'; |
574 | echo '<div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%">'; |
571 | } |
575 | } |
572 | 576 | ||
573 | function wb_draw_table_end() |
577 | function wb_draw_table_end() |
574 | { |
578 | { |
575 | echo '</table></div><br>'; |
579 | echo '</table></div><br>'; |
576 | } |
580 | } |
577 | 581 | ||
578 | function wb_draw_table_content() |
582 | function wb_draw_table_content() |
579 | { |
583 | { |
580 | echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">'; |
584 | echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">'; |
581 | $j = 0; |
585 | $j = 0; |
582 | for ($i=0; $i < @func_num_args(); $i=$i+2) |
586 | for ($i=0; $i < @func_num_args(); $i=$i+2) |
583 | { |
587 | { |
584 | $j++; |
588 | $j++; |
585 | if (@func_get_arg($i) != '') |
589 | if (@func_get_arg($i) != '') |
586 | $w = 'width="'.@func_get_arg($i).'" '; |
590 | $w = 'width="'.@func_get_arg($i).'" '; |
587 | else |
591 | else |
588 | $w = ''; |
592 | $w = ''; |
589 | echo '<td valign="top" align="left" '.$w.'>'.@func_get_arg($i+1).'</td>'; |
593 | echo '<td valign="top" align="left" '.$w.'>'.@func_get_arg($i+1).'</td>'; |
590 | } |
594 | } |
591 | if ($j == 0) |
595 | if ($j == 0) |
592 | echo '<td valign="top" align="left" width="100%"> </td>'; |
596 | echo '<td valign="top" align="left" width="100%"> </td>'; |
593 | echo '</tr>'."\n"; |
597 | echo '</tr>'."\n"; |
594 | } |
598 | } |
595 | 599 | ||
596 | function wb_draw_table_span_content($highlight, $span, $text) |
600 | function wb_draw_table_span_content($highlight, $span, $text) |
597 | { |
601 | { |
598 | if ($highlight == 1) $hfarb = '4'; |
602 | if ($highlight == 1) $hfarb = '4'; |
599 | if ($highlight == 0) $hfarb = '5'; |
603 | if ($highlight == 0) $hfarb = '5'; |
600 | if ($highlight == 2) $hfarb = '6'; |
604 | if ($highlight == 2) $hfarb = '6'; |
601 | echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">'; |
605 | echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">'; |
602 | echo '<td valign="top" align="left" colspan="'.$span.'">'.$text.'</td>'; |
606 | echo '<td valign="top" align="left" colspan="'.$span.'">'.$text.'</td>'; |
603 | echo '</tr>'; |
607 | echo '</tr>'; |
604 | 608 | ||
605 | } |
609 | } |
606 | 610 | ||
607 | function wb_draw_item_filter($modul, $table, $append) |
611 | function wb_draw_item_filter($modul, $table, $append) |
608 | { |
612 | { |
609 | global $ordnereinzug, $WBConfig; |
613 | global $ordnereinzug, $WBConfig; |
610 | 614 | ||
611 | $einzug = 0; |
615 | $einzug = 0; |
612 | $ary = wb_list_items_filter($modul, $table, $append); |
616 | $ary = wb_list_items_filter($modul, $table, $append); |
613 | $durchlauf = 0; |
617 | $durchlauf = 0; |
614 | for ($i=1; isset($ary[$i]['id']); $i++) |
618 | for ($i=1; isset($ary[$i]['id']); $i++) |
615 | { |
619 | { |
616 | $durchlauf++; |
620 | $durchlauf++; |
617 | 621 | ||
618 | if (file_exists('modules/'.$modul.'/includes/menuentry.inc.php')) |
622 | if (file_exists('modules/'.$modul.'/includes/menuentry.inc.php')) |
619 | include('modules/'.$modul.'/includes/menuentry.inc.php'); |
623 | include('modules/'.$modul.'/includes/menuentry.inc.php'); |
620 | 624 | ||
621 | echo "\n"; |
625 | echo "\n"; |
622 | } |
626 | } |
623 | 627 | ||
624 | return $durchlauf; |
628 | return $durchlauf; |
625 | } |
629 | } |
626 | 630 | ||
627 | function wb_draw_item($modul, $table, $append, $folder = 0, $einzug = 0) |
631 | function wb_draw_item($modul, $table, $append, $folder = 0, $einzug = 0) |
628 | { |
632 | { |
629 | global $ordnereinzug, $WBConfig; |
633 | global $ordnereinzug, $WBConfig; |
630 | 634 | ||
631 | $ary = wb_list_items($modul, $table, $append, $folder); |
635 | $ary = wb_list_items($modul, $table, $append, $folder); |
632 | $durchlauf = 0; |
636 | $durchlauf = 0; |
633 | for ($i=1; isset($ary[$i]['id']); $i++) |
637 | for ($i=1; isset($ary[$i]['id']); $i++) |
634 | { |
638 | { |
635 | $durchlauf++; |
639 | $durchlauf++; |
636 | 640 | ||
637 | if (file_exists('modules/'.$modul.'/includes/menuentry.inc.php')) |
641 | if (file_exists('modules/'.$modul.'/includes/menuentry.inc.php')) |
638 | include('modules/'.$modul.'/includes/menuentry.inc.php'); |
642 | include('modules/'.$modul.'/includes/menuentry.inc.php'); |
639 | } |
643 | } |
640 | 644 | ||
641 | return $durchlauf; |
645 | return $durchlauf; |
642 | } |
646 | } |
643 | 647 | ||
644 | function wb_draw_menu_item($modul, $seite, $titel, $klein, $gross) |
648 | function wb_draw_menu_item($modul, $seite, $titel, $klein, $gross) |
645 | { |
649 | { |
646 | if (file_exists($gross)) |
650 | if (file_exists($gross)) |
647 | $g = $gross; |
651 | $g = $gross; |
648 | else |
652 | else |
649 | $g = 'designs/spacer.gif'; |
653 | $g = 'designs/spacer.gif'; |
650 | 654 | ||
651 | if (file_exists($klein)) |
655 | if (file_exists($klein)) |
652 | $k = $klein; |
656 | $k = $klein; |
653 | else |
657 | else |
654 | $k = 'designs/spacer.gif'; |
658 | $k = 'designs/spacer.gif'; |
655 | 659 | ||
656 | return '<tr class="row_nav" onmouseover="this.className=\'row_nav_act\';" onmouseout="this.className=\'row_nav\';"> |
660 | return '<tr class="row_nav" onmouseover="this.className=\'row_nav_act\';" onmouseout="this.className=\'row_nav\';"> |
657 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="designs/spacer.gif" height="1" width="3" alt=""></td> |
661 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="designs/spacer.gif" height="1" width="3" alt=""></td> |
658 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="'.$k.'" height="16" width="16" alt=""></td> |
662 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="'.$k.'" height="16" width="16" alt=""></td> |
659 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="designs/spacer.gif" height="1" width="5" alt=""></td> |
663 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="designs/spacer.gif" height="1" width="5" alt=""></td> |
660 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left" width="100%"><a href="javascript:oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" class="menu_blk">'.$titel.'</a></td> |
664 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left" width="100%"><a href="javascript:oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" class="menu_blk">'.$titel.'</a></td> |
661 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="designs/spacer.gif" alt="" width="1" height="1"></td> |
665 | <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="designs/spacer.gif" alt="" width="1" height="1"></td> |
662 | </tr>'."\n"; |
666 | </tr>'."\n"; |
663 | } |
667 | } |
664 | 668 | ||
665 | function wb_draw_menu_spacer() |
669 | function wb_draw_menu_spacer() |
666 | { |
670 | { |
667 | return '<tr> |
671 | return '<tr> |
668 | <td colspan="5"><img src="designs/spacer.gif" alt="" width="1" height="14"></td> |
672 | <td colspan="5"><img src="designs/spacer.gif" alt="" width="1" height="14"></td> |
669 | </tr>'; |
673 | </tr>'; |
670 | } |
674 | } |
671 | 675 | ||
672 | ////////////////////////////////////////////////////////////////////////////// |
676 | ////////////////////////////////////////////////////////////////////////////// |
673 | // FUNKTIONEN FÜR MODUL-XML UND DESIGN-XML // |
677 | // FUNKTIONEN FÜR MODUL-XML UND DESIGN-XML // |
674 | ////////////////////////////////////////////////////////////////////////////// |
678 | ////////////////////////////////////////////////////////////////////////////// |
675 | 679 | ||
676 | require 'includes/xml.class.inc.php'; |
680 | require 'includes/xml.class.inc.php'; |
677 | require 'includes/SecureMailer.class.php'; |
681 | require 'includes/SecureMailer.class.php'; |
678 | 682 | ||
679 | ////////////////////////////////////////////////////////////////////////////// |
683 | ////////////////////////////////////////////////////////////////////////////// |
680 | // FUNKTIONEN FÜR MODUL-XML UND DESIGN-XML // |
684 | // FUNKTIONEN FÜR MODUL-XML UND DESIGN-XML // |
681 | ////////////////////////////////////////////////////////////////////////////// |
685 | ////////////////////////////////////////////////////////////////////////////// |
682 | 686 | ||
- | 687 | class WebBase_Module_Info |
|
- | 688 | { |
|
- | 689 | private $f_name; |
|
- | 690 | private $f_author; |
|
- | 691 | private $f_version; |
|
- | 692 | private $f_language; |
|
- | 693 | ||
- | 694 | // 0 = Public Freeware |
|
- | 695 | // 1 = Public Shareware |
|
- | 696 | // 2 = Private Secured |
|
- | 697 | // 3 = Personal WebBase-Core |
|
- | 698 | // 4 = Personal WebBase-Enclosure |
|
- | 699 | private $f_license; |
|
- | 700 | ||
- | 701 | function name() { |
|
- | 702 | return $this->f_name; |
|
- | 703 | } |
|
- | 704 | ||
- | 705 | function author() { |
|
- | 706 | return $this->f_author; |
|
- | 707 | } |
|
- | 708 | ||
- | 709 | function version() { |
|
- | 710 | return $this->f_version; |
|
- | 711 | } |
|
- | 712 | ||
- | 713 | function language() { |
|
- | 714 | return $this->f_language; |
|
- | 715 | } |
|
- | 716 | ||
- | 717 | function license() { |
|
- | 718 | return $this->f_license; |
|
- | 719 | } |
|
- | 720 | ||
- | 721 | function WebBase_Module_Info($name, $author, $version, $language, $license) { |
|
- | 722 | $this->f_name = $name; |
|
- | 723 | $this->f_author = $author; |
|
- | 724 | $this->f_version = $version; |
|
- | 725 | $this->f_language = $language; |
|
- | 726 | $this->f_license = $license; |
|
- | 727 | } |
|
- | 728 | }; |
|
- | 729 | ||
683 | require 'includes/WBModulHandler.class.php'; |
730 | class WBModuleHandler { |
- | 731 | ||
- | 732 | private static $cache_module_information = Array(); |
|
- | 733 | ||
- | 734 | function get_module_information($modulename) |
|
- | 735 | { |
|
- | 736 | if (isset(self::$cache_module_information[$modulename])) { |
|
- | 737 | return self::$cache_module_information[$modulename]; |
|
- | 738 | } |
|
- | 739 | ||
- | 740 | if (function_exists('getmicrotime')) $ss = getmicrotime(); |
|
- | 741 | ||
- | 742 | $xml = new xml(); |
|
- | 743 | ||
- | 744 | if ((!strpos($modulename, '..')) && (file_exists('modules/'.$modulename.'/info.xml'))) |
|
- | 745 | { |
|
- | 746 | $object = $xml->xml_file_to_object('modules/'.$modulename.'/info.xml'); |
|
- | 747 | ||
- | 748 | if ($object->name == 'moduleinfo') |
|
- | 749 | { |
|
- | 750 | $v_expected_name = ''; |
|
- | 751 | $v_author = ''; |
|
- | 752 | $v_version = ''; |
|
- | 753 | $v_language = ''; |
|
- | 754 | $v_license = ''; |
|
- | 755 | ||
- | 756 | foreach ($object->children as $m1 => $m2) |
|
- | 757 | { |
|
- | 758 | if ($object->children[$m1]->name == 'expected_name') $v_expected_name = $object->children[$m1]->content; |
|
- | 759 | if ($object->children[$m1]->name == 'author') $v_author = $object->children[$m1]->content; |
|
- | 760 | if ($object->children[$m1]->name == 'version') $v_version = $object->children[$m1]->content; |
|
- | 761 | if ($object->children[$m1]->name == 'language') $v_language = $object->children[$m1]->content; |
|
- | 762 | if ($object->children[$m1]->name == 'license') $v_license = $object->children[$m1]->content; |
|
- | 763 | } |
|
- | 764 | ||
- | 765 | $output = new WebBase_Module_Info($v_expected_name, $v_author, $v_version, $v_language, $v_license); |
|
- | 766 | ||
- | 767 | if ($output->caption == '') $output->caption = $modulename; |
|
- | 768 | ||
- | 769 | if (function_exists('getmicrotime')) { |
|
- | 770 | $ee = getmicrotime(); |
|
- | 771 | global $xml_time; |
|
- | 772 | $xml_time += $ee-$ss; |
|
- | 773 | global $xml_count; |
|
- | 774 | $xml_count++; |
|
- | 775 | } |
|
- | 776 | ||
- | 777 | self::$cache_module_information[$modulename] = $output; |
|
- | 778 | ||
- | 779 | return $output; |
|
- | 780 | } |
|
- | 781 | else |
|
- | 782 | { |
|
- | 783 | return NULL; |
|
- | 784 | } |
|
- | 785 | } |
|
- | 786 | else |
|
- | 787 | { |
|
- | 788 | return NULL; |
|
- | 789 | } |
|
- | 790 | } |
|
684 | 791 | ||
- | 792 | } |
|
- | 793 | ||
- | 794 | class WebBase_Design_Info |
|
- | 795 | { |
|
- | 796 | private $f_name; |
|
- | 797 | private $f_author; |
|
- | 798 | private $f_version; |
|
- | 799 | ||
- | 800 | // 0 = Third-Party-Product |
|
- | 801 | // 1 = Official Product |
|
- | 802 | private $f_license; |
|
- | 803 | ||
- | 804 | function name() { |
|
- | 805 | return $this->f_name; |
|
- | 806 | } |
|
- | 807 | ||
- | 808 | function author() { |
|
- | 809 | return $this->f_author; |
|
- | 810 | } |
|
- | 811 | ||
- | 812 | function version() { |
|
- | 813 | return $this->f_version; |
|
- | 814 | } |
|
- | 815 | ||
- | 816 | function license() { |
|
- | 817 | return $this->f_license; |
|
- | 818 | } |
|
- | 819 | ||
- | 820 | function WebBase_Design_Info($name, $author, $version, $license) { |
|
- | 821 | $this->f_name = $name; |
|
- | 822 | $this->f_author = $author; |
|
- | 823 | $this->f_version = $version; |
|
- | 824 | $this->f_license = $license; |
|
- | 825 | } |
|
- | 826 | }; |
|
- | 827 | ||
- | 828 | class WBModuleHandler { |
|
- | 829 | ||
- | 830 | private static $cache_design_information = Array(); |
|
- | 831 | ||
- | 832 | function get_design_information($designname) |
|
- | 833 | { |
|
- | 834 | if (isset(self::$cache_design_information[$designname])) { |
|
685 | require 'includes/WBDesignHandler.class.php'; |
835 | return self::$cache_design_information[$designname]; |
- | 836 | } |
|
- | 837 | ||
- | 838 | if (function_exists('getmicrotime')) $ss = getmicrotime(); |
|
- | 839 | ||
- | 840 | $xml = new xml(); |
|
- | 841 | ||
- | 842 | if ((!strpos($designname, '..')) && (file_exists('designs/'.$designname.'/info.xml'))) |
|
- | 843 | { |
|
- | 844 | $object = $xml->xml_file_to_object('designs/'.$designname.'/info.xml'); |
|
- | 845 | ||
- | 846 | if ($object->name == 'designinfo') |
|
- | 847 | { |
|
- | 848 | $v_name = ''; |
|
- | 849 | $v_author = ''; |
|
- | 850 | $v_version = ''; |
|
- | 851 | $v_license = ''; |
|
- | 852 | ||
- | 853 | foreach ($object->children as $m1 => $m2) |
|
- | 854 | { |
|
- | 855 | if ($object->children[$m1]->name == 'name') $v_name = $object->children[$m1]->content; |
|
- | 856 | if ($object->children[$m1]->name == 'author') $v_author = $object->children[$m1]->content; |
|
- | 857 | if ($object->children[$m1]->name == 'version') $v_version = $object->children[$m1]->content; |
|
- | 858 | if ($object->children[$m1]->name == 'license') $v_license = $object->children[$m1]->content; |
|
- | 859 | } |
|
- | 860 | ||
- | 861 | $output = new WebBase_Design_Info($v_name, $v_author, $v_version, $v_license); |
|
- | 862 | ||
- | 863 | if ($output->name == '') $output->name = $designname; |
|
- | 864 | ||
- | 865 | if (function_exists('getmicrotime')) { |
|
- | 866 | $ee = getmicrotime(); |
|
- | 867 | global $xml_time; |
|
- | 868 | $xml_time += $ee-$ss; |
|
- | 869 | global $xml_count; |
|
- | 870 | $xml_count++; |
|
- | 871 | } |
|
- | 872 | ||
- | 873 | self::$cache_design_information[$designname] = $output; |
|
- | 874 | ||
- | 875 | return $output; |
|
- | 876 | } |
|
- | 877 | else |
|
- | 878 | { |
|
- | 879 | return NULL; |
|
- | 880 | } |
|
- | 881 | } |
|
- | 882 | else |
|
- | 883 | { |
|
- | 884 | return NULL; |
|
- | 885 | } |
|
- | 886 | } |
|
- | 887 | } |
|
686 | 888 | ||
687 | /* Konstanten */ |
889 | /* Konstanten */ |
688 | 890 | ||
689 | define('RELATIVE_DIR', dir_add_trailing_backslash(dirname($_SERVER['PHP_SELF']))); |
891 | define('RELATIVE_DIR', dir_add_trailing_backslash(dirname($_SERVER['PHP_SELF']))); |
690 | 892 | ||
691 | ?> |
893 | ?> |
692 | 894 |