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