Subversion Repositories personal-webbase

Rev

Rev 14 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 14 Rev 15
1
<?php
1
<?php
2
 
2
 
3
if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgef&uuml;hrt werden.');
3
if (!defined('WBLEGAL')) die('Kann nicht ohne Personal WebBase ausgef&uuml;hrt werden.');
4
 
4
 
5
//////////////////////////////////////////////////////////////////////////////
5
//////////////////////////////////////////////////////////////////////////////
6
// CODIERUNGSFUNKTIONEN                                                     //
6
// CODIERUNGSFUNKTIONEN                                                     //
7
//////////////////////////////////////////////////////////////////////////////
7
//////////////////////////////////////////////////////////////////////////////
8
 
8
 
9
function transamp_replace_spitze_klammern($inp)
9
function transamp_replace_spitze_klammern($inp)
10
{
10
{
11
  $inp = str_replace('&', '&amp;', $inp);
11
  $inp = str_replace('&', '&amp;', $inp);
12
  //$inp = str_replace('"', '&quot;', $inp);
12
  //$inp = str_replace('"', '&quot;', $inp);
13
  $inp = str_replace('<', '&lt;', $inp);
13
  $inp = str_replace('<', '&lt;', $inp);
14
  $inp = str_replace('>', '&gt;', $inp);
14
  $inp = str_replace('>', '&gt;', $inp);
15
 
15
 
16
  return $inp;
16
  return $inp;
17
}
17
}
18
 
18
 
19
function undo_transamp_replace_spitze_klammern($inp)
19
function undo_transamp_replace_spitze_klammern($inp)
20
{
20
{
21
  $inp = str_replace('&amp;', '&', $inp);
21
  $inp = str_replace('&amp;', '&', $inp);
22
  //$inp = str_replace('&quot;', '"', $inp);
22
  //$inp = str_replace('&quot;', '"', $inp);
23
  $inp = str_replace('&lt;', '<', $inp);
23
  $inp = str_replace('&lt;', '<', $inp);
24
  $inp = str_replace('&gt;', '>', $inp);
24
  $inp = str_replace('&gt;', '>', $inp);
25
 
25
 
26
  return $inp;
26
  return $inp;
27
}
27
}
28
 
28
 
29
function ausfuehrbarer_html_code($inp)
29
function ausfuehrbarer_html_code($inp)
30
{
30
{
31
  // Wenn der Benutzer z.B. ä im HTML-Formular eingegeben hat, würde hier aufgrund von Unicode quatsch rauskommen
31
  // Wenn der Benutzer z.B. ä im HTML-Formular eingegeben hat, würde hier aufgrund von Unicode quatsch rauskommen
32
  $inp = my_htmlentities($inp);
32
  $inp = my_htmlentities($inp);
33
 
33
 
34
  $inp = undo_transamp_replace_spitze_klammern($inp);
34
  $inp = undo_transamp_replace_spitze_klammern($inp);
35
 
35
 
36
  $trans = get_html_translation_table(HTML_ENTITIES);
36
  $trans = get_html_translation_table(HTML_ENTITIES);
37
  foreach ($trans as $m1 => $m2)
37
  foreach ($trans as $m1 => $m2)
38
  {
38
  {
39
    if (($m2 != '&lt;') && ($m2 != '&gt;'))
39
    if (($m2 != '&lt;') && ($m2 != '&gt;'))
40
      $inp = str_replace(str_replace('&', '&amp;', $m2), $m2, $inp);
40
      $inp = str_replace(str_replace('&', '&amp;', $m2), $m2, $inp);
41
  }
41
  }
42
  unset($m1);
42
  unset($m1);
43
  unset($m2);
43
  unset($m2);
44
 
44
 
45
  // Erweiterte Zeichensatztabelle, die auch da Euro-Zeichen enthält
45
  // Erweiterte Zeichensatztabelle, die auch da Euro-Zeichen enthält
46
  // Entnommen von http://www.php.net/manual/de/function.get-html-translation-table.php#73410
46
  // Entnommen von http://www.php.net/manual/de/function.get-html-translation-table.php#73410
47
  $trans2 = array('&apos;'=>'&#39;', '&minus;'=>'&#45;', '&circ;'=>'&#94;', '&tilde;'=>'&#126;', '&Scaron;'=>'&#138;', '&lsaquo;'=>'&#139;', '&OElig;'=>'&#140;', '&lsquo;'=>'&#145;', '&rsquo;'=>'&#146;', '&ldquo;'=>'&#147;', '&rdquo;'=>'&#148;', '&bull;'=>'&#149;', '&ndash;'=>'&#150;', '&mdash;'=>'&#151;', '&tilde;'=>'&#152;', '&trade;'=>'&#153;', '&scaron;'=>'&#154;', '&rsaquo;'=>'&#155;', '&oelig;'=>'&#156;', '&Yuml;'=>'&#159;', '&yuml;'=>'&#255;', '&OElig;'=>'&#338;', '&oelig;'=>'&#339;', '&Scaron;'=>'&#352;', '&scaron;'=>'&#353;', '&Yuml;'=>'&#376;', '&fnof;'=>'&#402;', '&circ;'=>'&#710;', '&tilde;'=>'&#732;', '&Alpha;'=>'&#913;', '&Beta;'=>'&#914;', '&Gamma;'=>'&#915;', '&Delta;'=>'&#916;', '&Epsilon;'=>'&#917;', '&Zeta;'=>'&#918;', '&Eta;'=>'&#919;', '&Theta;'=>'&#920;', '&Iota;'=>'&#921;', '&Kappa;'=>'&#922;', '&Lambda;'=>'&#923;', '&Mu;'=>'&#924;', '&Nu;'=>'&#925;', '&Xi;'=>'&#926;', '&Omicron;'=>'&#927;', '&Pi;'=>'&#928;', '&Rho;'=>'&#929;', '&Sigma;'=>'&#931;', '&Tau;'=>'&#932;', '&Upsilon;'=>'&#933;', '&Phi;'=>'&#934;', '&Chi;'=>'&#935;', '&Psi;'=>'&#936;', '&Omega;'=>'&#937;', '&alpha;'=>'&#945;', '&beta;'=>'&#946;', '&gamma;'=>'&#947;', '&delta;'=>'&#948;', '&epsilon;'=>'&#949;', '&zeta;'=>'&#950;', '&eta;'=>'&#951;', '&theta;'=>'&#952;', '&iota;'=>'&#953;', '&kappa;'=>'&#954;', '&lambda;'=>'&#955;', '&mu;'=>'&#956;', '&nu;'=>'&#957;', '&xi;'=>'&#958;', '&omicron;'=>'&#959;', '&pi;'=>'&#960;', '&rho;'=>'&#961;', '&sigmaf;'=>'&#962;', '&sigma;'=>'&#963;', '&tau;'=>'&#964;', '&upsilon;'=>'&#965;', '&phi;'=>'&#966;', '&chi;'=>'&#967;', '&psi;'=>'&#968;', '&omega;'=>'&#969;', '&thetasym;'=>'&#977;', '&upsih;'=>'&#978;', '&piv;'=>'&#982;', '&ensp;'=>'&#8194;', '&emsp;'=>'&#8195;', '&thinsp;'=>'&#8201;', '&zwnj;'=>'&#8204;', '&zwj;'=>'&#8205;', '&lrm;'=>'&#8206;', '&rlm;'=>'&#8207;', '&ndash;'=>'&#8211;', '&mdash;'=>'&#8212;', '&lsquo;'=>'&#8216;', '&rsquo;'=>'&#8217;', '&sbquo;'=>'&#8218;', '&ldquo;'=>'&#8220;', '&rdquo;'=>'&#8221;', '&bdquo;'=>'&#8222;', '&dagger;'=>'&#8224;', '&Dagger;'=>'&#8225;', '&bull;'=>'&#8226;', '&hellip;'=>'&#8230;', '&permil;'=>'&#8240;', '&prime;'=>'&#8242;', '&Prime;'=>'&#8243;', '&lsaquo;'=>'&#8249;', '&rsaquo;'=>'&#8250;', '&oline;'=>'&#8254;', '&frasl;'=>'&#8260;', '&euro;'=>'&#8364;', '&image;'=>'&#8465;', '&weierp;'=>'&#8472;', '&real;'=>'&#8476;', '&trade;'=>'&#8482;', '&alefsym;'=>'&#8501;', '&larr;'=>'&#8592;', '&uarr;'=>'&#8593;', '&rarr;'=>'&#8594;', '&darr;'=>'&#8595;', '&harr;'=>'&#8596;', '&crarr;'=>'&#8629;', '&lArr;'=>'&#8656;', '&uArr;'=>'&#8657;', '&rArr;'=>'&#8658;', '&dArr;'=>'&#8659;', '&hArr;'=>'&#8660;', '&forall;'=>'&#8704;', '&part;'=>'&#8706;', '&exist;'=>'&#8707;', '&empty;'=>'&#8709;', '&nabla;'=>'&#8711;', '&isin;'=>'&#8712;', '&notin;'=>'&#8713;', '&ni;'=>'&#8715;', '&prod;'=>'&#8719;', '&sum;'=>'&#8721;', '&minus;'=>'&#8722;', '&lowast;'=>'&#8727;', '&radic;'=>'&#8730;', '&prop;'=>'&#8733;', '&infin;'=>'&#8734;', '&ang;'=>'&#8736;', '&and;'=>'&#8743;', '&or;'=>'&#8744;', '&cap;'=>'&#8745;', '&cup;'=>'&#8746;', '&int;'=>'&#8747;', '&there4;'=>'&#8756;', '&sim;'=>'&#8764;', '&cong;'=>'&#8773;', '&asymp;'=>'&#8776;', '&ne;'=>'&#8800;', '&equiv;'=>'&#8801;', '&le;'=>'&#8804;', '&ge;'=>'&#8805;', '&sub;'=>'&#8834;', '&sup;'=>'&#8835;', '&nsub;'=>'&#8836;', '&sube;'=>'&#8838;', '&supe;'=>'&#8839;', '&oplus;'=>'&#8853;', '&otimes;'=>'&#8855;', '&perp;'=>'&#8869;', '&sdot;'=>'&#8901;', '&lceil;'=>'&#8968;', '&rceil;'=>'&#8969;', '&lfloor;'=>'&#8970;', '&rfloor;'=>'&#8971;', '&lang;'=>'&#9001;', '&rang;'=>'&#9002;', '&loz;'=>'&#9674;', '&spades;'=>'&#9824;', '&clubs;'=>'&#9827;', '&hearts;'=>'&#9829;', '&diams;'=>'&#9830;');
47
  $trans2 = array('&apos;'=>'&#39;', '&minus;'=>'&#45;', '&circ;'=>'&#94;', '&tilde;'=>'&#126;', '&Scaron;'=>'&#138;', '&lsaquo;'=>'&#139;', '&OElig;'=>'&#140;', '&lsquo;'=>'&#145;', '&rsquo;'=>'&#146;', '&ldquo;'=>'&#147;', '&rdquo;'=>'&#148;', '&bull;'=>'&#149;', '&ndash;'=>'&#150;', '&mdash;'=>'&#151;', '&tilde;'=>'&#152;', '&trade;'=>'&#153;', '&scaron;'=>'&#154;', '&rsaquo;'=>'&#155;', '&oelig;'=>'&#156;', '&Yuml;'=>'&#159;', '&yuml;'=>'&#255;', '&OElig;'=>'&#338;', '&oelig;'=>'&#339;', '&Scaron;'=>'&#352;', '&scaron;'=>'&#353;', '&Yuml;'=>'&#376;', '&fnof;'=>'&#402;', '&circ;'=>'&#710;', '&tilde;'=>'&#732;', '&Alpha;'=>'&#913;', '&Beta;'=>'&#914;', '&Gamma;'=>'&#915;', '&Delta;'=>'&#916;', '&Epsilon;'=>'&#917;', '&Zeta;'=>'&#918;', '&Eta;'=>'&#919;', '&Theta;'=>'&#920;', '&Iota;'=>'&#921;', '&Kappa;'=>'&#922;', '&Lambda;'=>'&#923;', '&Mu;'=>'&#924;', '&Nu;'=>'&#925;', '&Xi;'=>'&#926;', '&Omicron;'=>'&#927;', '&Pi;'=>'&#928;', '&Rho;'=>'&#929;', '&Sigma;'=>'&#931;', '&Tau;'=>'&#932;', '&Upsilon;'=>'&#933;', '&Phi;'=>'&#934;', '&Chi;'=>'&#935;', '&Psi;'=>'&#936;', '&Omega;'=>'&#937;', '&alpha;'=>'&#945;', '&beta;'=>'&#946;', '&gamma;'=>'&#947;', '&delta;'=>'&#948;', '&epsilon;'=>'&#949;', '&zeta;'=>'&#950;', '&eta;'=>'&#951;', '&theta;'=>'&#952;', '&iota;'=>'&#953;', '&kappa;'=>'&#954;', '&lambda;'=>'&#955;', '&mu;'=>'&#956;', '&nu;'=>'&#957;', '&xi;'=>'&#958;', '&omicron;'=>'&#959;', '&pi;'=>'&#960;', '&rho;'=>'&#961;', '&sigmaf;'=>'&#962;', '&sigma;'=>'&#963;', '&tau;'=>'&#964;', '&upsilon;'=>'&#965;', '&phi;'=>'&#966;', '&chi;'=>'&#967;', '&psi;'=>'&#968;', '&omega;'=>'&#969;', '&thetasym;'=>'&#977;', '&upsih;'=>'&#978;', '&piv;'=>'&#982;', '&ensp;'=>'&#8194;', '&emsp;'=>'&#8195;', '&thinsp;'=>'&#8201;', '&zwnj;'=>'&#8204;', '&zwj;'=>'&#8205;', '&lrm;'=>'&#8206;', '&rlm;'=>'&#8207;', '&ndash;'=>'&#8211;', '&mdash;'=>'&#8212;', '&lsquo;'=>'&#8216;', '&rsquo;'=>'&#8217;', '&sbquo;'=>'&#8218;', '&ldquo;'=>'&#8220;', '&rdquo;'=>'&#8221;', '&bdquo;'=>'&#8222;', '&dagger;'=>'&#8224;', '&Dagger;'=>'&#8225;', '&bull;'=>'&#8226;', '&hellip;'=>'&#8230;', '&permil;'=>'&#8240;', '&prime;'=>'&#8242;', '&Prime;'=>'&#8243;', '&lsaquo;'=>'&#8249;', '&rsaquo;'=>'&#8250;', '&oline;'=>'&#8254;', '&frasl;'=>'&#8260;', '&euro;'=>'&#8364;', '&image;'=>'&#8465;', '&weierp;'=>'&#8472;', '&real;'=>'&#8476;', '&trade;'=>'&#8482;', '&alefsym;'=>'&#8501;', '&larr;'=>'&#8592;', '&uarr;'=>'&#8593;', '&rarr;'=>'&#8594;', '&darr;'=>'&#8595;', '&harr;'=>'&#8596;', '&crarr;'=>'&#8629;', '&lArr;'=>'&#8656;', '&uArr;'=>'&#8657;', '&rArr;'=>'&#8658;', '&dArr;'=>'&#8659;', '&hArr;'=>'&#8660;', '&forall;'=>'&#8704;', '&part;'=>'&#8706;', '&exist;'=>'&#8707;', '&empty;'=>'&#8709;', '&nabla;'=>'&#8711;', '&isin;'=>'&#8712;', '&notin;'=>'&#8713;', '&ni;'=>'&#8715;', '&prod;'=>'&#8719;', '&sum;'=>'&#8721;', '&minus;'=>'&#8722;', '&lowast;'=>'&#8727;', '&radic;'=>'&#8730;', '&prop;'=>'&#8733;', '&infin;'=>'&#8734;', '&ang;'=>'&#8736;', '&and;'=>'&#8743;', '&or;'=>'&#8744;', '&cap;'=>'&#8745;', '&cup;'=>'&#8746;', '&int;'=>'&#8747;', '&there4;'=>'&#8756;', '&sim;'=>'&#8764;', '&cong;'=>'&#8773;', '&asymp;'=>'&#8776;', '&ne;'=>'&#8800;', '&equiv;'=>'&#8801;', '&le;'=>'&#8804;', '&ge;'=>'&#8805;', '&sub;'=>'&#8834;', '&sup;'=>'&#8835;', '&nsub;'=>'&#8836;', '&sube;'=>'&#8838;', '&supe;'=>'&#8839;', '&oplus;'=>'&#8853;', '&otimes;'=>'&#8855;', '&perp;'=>'&#8869;', '&sdot;'=>'&#8901;', '&lceil;'=>'&#8968;', '&rceil;'=>'&#8969;', '&lfloor;'=>'&#8970;', '&rfloor;'=>'&#8971;', '&lang;'=>'&#9001;', '&rang;'=>'&#9002;', '&loz;'=>'&#9674;', '&spades;'=>'&#9824;', '&clubs;'=>'&#9827;', '&hearts;'=>'&#9829;', '&diams;'=>'&#9830;');
48
  $trans2 = array_flip($trans2);
48
  $trans2 = array_flip($trans2);
49
  foreach ($trans2 as $m1 => $m2)
49
  foreach ($trans2 as $m1 => $m2)
50
  {
50
  {
51
    // Funktioniert chr() bei den 8... Einträgen? Finde Eurozeichen nicht bei chr(8364)!
51
    // Funktioniert chr() bei den 8... Einträgen? Finde Eurozeichen nicht bei chr(8364)!
52
    $m1 = chr(substr($m1, 2, strlen($m1)-3));
52
    $m1 = chr(substr($m1, 2, strlen($m1)-3));
53
 
53
 
54
    if (($m2 != '&lt;') && ($m2 != '&gt;'))
54
    if (($m2 != '&lt;') && ($m2 != '&gt;'))
55
      $inp = str_replace(str_replace('&', '&amp;', $m2), $m2, $inp);
55
      $inp = str_replace(str_replace('&', '&amp;', $m2), $m2, $inp);
56
  }
56
  }
57
  unset($m1);
57
  unset($m1);
58
  unset($m2);
58
  unset($m2);
59
 
59
 
60
  return undo_transamp_replace_spitze_klammern($inp);
60
  return undo_transamp_replace_spitze_klammern($inp);
61
}
61
}
62
 
62
 
63
//////////////////////////////////////////////////////////////////////////////
63
//////////////////////////////////////////////////////////////////////////////
64
// VERSCHLÜSSELUNGSFUNKTIONEN FÜR SESSIONS U.A.                             //
64
// VERSCHLÜSSELUNGSFUNKTIONEN FÜR SESSIONS U.A.                             //
65
//////////////////////////////////////////////////////////////////////////////
65
//////////////////////////////////////////////////////////////////////////////
66
 
66
 
67
function special_hash($string)
67
function special_hash($string)
68
{
68
{
69
  $iterations = 10;
69
  $iterations = 10;
70
 
70
 
71
  $last = $string;
71
  $last = $string;
72
  $out = '';
72
  $out = '';
73
  for ($i=0; $i<$iterations; $i++)
73
  for ($i=0; $i<$iterations; $i++)
74
  {
74
  {
75
    $last = md5($last);
75
    $last = md5($last);
76
    $out .= $last;
76
    $out .= $last;
77
  }
77
  }
78
 
78
 
79
  $garbarge_count = 0;
79
  $garbarge_count = 0;
80
  for ($i=0; $i<strlen($last); $i++)
80
  for ($i=0; $i<strlen($last); $i++)
81
  {
81
  {
82
    if (($last[$i] == '0') || ($last[$i] == '1') || ($last[$i] == '2') || ($last[$i] == '3') ||
82
    if (($last[$i] == '0') || ($last[$i] == '1') || ($last[$i] == '2') || ($last[$i] == '3') ||
83
        ($last[$i] == '4') || ($last[$i] == '5') || ($last[$i] == '6') || ($last[$i] == '7') ||
83
        ($last[$i] == '4') || ($last[$i] == '5') || ($last[$i] == '6') || ($last[$i] == '7') ||
84
        ($last[$i] == '8') || ($last[$i] == '9'))
84
        ($last[$i] == '8') || ($last[$i] == '9'))
85
    {
85
    {
86
      $garbarge_count = $garbarge_count + $last[$i];
86
      $garbarge_count = $garbarge_count + $last[$i];
87
    }
87
    }
88
  }
88
  }
89
 
89
 
90
  for ($i=0; $i<=$garbarge_count; $i++)
90
  for ($i=0; $i<=$garbarge_count; $i++)
91
  {
91
  {
92
    $out = $last[0].$out.$last[1];
92
    $out = $last[0].$out.$last[1];
93
  }
93
  }
94
 
94
 
95
  if (strlen($out) > 1024) $out = substr($out, 0, 1024);
95
  if (strlen($out) > 1024) $out = substr($out, 0, 1024);
96
 
96
 
97
  return $out;
97
  return $out;
98
}
98
}
99
 
99
 
100
function get_rnd_iv($iv_len)
100
function get_rnd_iv($iv_len)
101
{
101
{
102
    $iv = '';
102
    $iv = '';
103
    while ($iv_len-- > 0) {
103
    while ($iv_len-- > 0) {
104
        $iv .= chr(mt_rand() & 0xff);
104
        $iv .= chr(mt_rand() & 0xff);
105
    }
105
    }
106
    return $iv;
106
    return $iv;
107
}
107
}
108
 
108
 
109
function md5_encrypt($plain_text, $password, $iv_len = 16)
109
function md5_encrypt($plain_text, $password, $iv_len = 16)
110
{
110
{
111
    $plain_text .= "\x13";
111
    $plain_text .= "\x13";
112
    $n = strlen($plain_text);
112
    $n = strlen($plain_text);
113
    if ($n % 16) $plain_text .= str_repeat("\0", 16 - ($n % 16));
113
    if ($n % 16) $plain_text .= str_repeat("\0", 16 - ($n % 16));
114
    $i = 0;
114
    $i = 0;
115
    $enc_text = get_rnd_iv($iv_len);
115
    $enc_text = get_rnd_iv($iv_len);
116
    $iv = substr($password ^ $enc_text, 0, 512);
116
    $iv = substr($password ^ $enc_text, 0, 512);
117
    while ($i < $n) {
117
    while ($i < $n) {
118
        $block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv));
118
        $block = substr($plain_text, $i, 16) ^ pack('H*', md5($iv));
119
        $enc_text .= $block;
119
        $enc_text .= $block;
120
        $iv = substr($block . $iv, 0, 512) ^ $password;
120
        $iv = substr($block . $iv, 0, 512) ^ $password;
121
        $i += 16;
121
        $i += 16;
122
    }
122
    }
123
    return base64_encode($enc_text);
123
    return base64_encode($enc_text);
124
}
124
}
125
 
125
 
126
function md5_decrypt($enc_text, $password, $iv_len = 16)
126
function md5_decrypt($enc_text, $password, $iv_len = 16)
127
{
127
{
128
    $enc_text = base64_decode($enc_text);
128
    $enc_text = base64_decode($enc_text);
129
    $n = strlen($enc_text);
129
    $n = strlen($enc_text);
130
    $i = $iv_len;
130
    $i = $iv_len;
131
    $plain_text = '';
131
    $plain_text = '';
132
    $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
132
    $iv = substr($password ^ substr($enc_text, 0, $iv_len), 0, 512);
133
    while ($i < $n) {
133
    while ($i < $n) {
134
        $block = substr($enc_text, $i, 16);
134
        $block = substr($enc_text, $i, 16);
135
        $plain_text .= $block ^ pack('H*', md5($iv));
135
        $plain_text .= $block ^ pack('H*', md5($iv));
136
        $iv = substr($block . $iv, 0, 512) ^ $password;
136
        $iv = substr($block . $iv, 0, 512) ^ $password;
137
        $i += 16;
137
        $i += 16;
138
    }
138
    }
139
    return preg_replace('/\\x13\\x00*$/', '', $plain_text);
139
    return preg_replace('/\\x13\\x00*$/', '', $plain_text);
140
}
140
}
141
 
141
 
142
function ib_encrypt($message, $key)
142
function ib_encrypt($message, $key)
143
{
143
{
144
  return md5_encrypt($message, $key);
144
  return md5_encrypt($message, $key);
145
}
145
}
146
 
146
 
147
function ib_decrypt($message, $key)
147
function ib_decrypt($message, $key)
148
{
148
{
149
  return md5_decrypt($message, $key);
149
  return md5_decrypt($message, $key);
150
}
150
}
151
 
151
 
152
//////////////////////////////////////////////////////////////////////////////
152
//////////////////////////////////////////////////////////////////////////////
153
// NÜTZLICHE FUNKTIONEN                                                     //
153
// NÜTZLICHE FUNKTIONEN                                                     //
154
//////////////////////////////////////////////////////////////////////////////
154
//////////////////////////////////////////////////////////////////////////////
155
 
155
 
156
function dirname_with_pathdelimiter($directory)
156
function dirname_with_pathdelimiter($directory)
157
{
157
{
158
  $tmp = dirname($directory);
158
  $tmp = dirname($directory);
159
  $tmp = str_replace('\\', '/', $tmp);
159
  $tmp = str_replace('\\', '/', $tmp);
160
  if (substr($tmp, strlen($tmp)-1, 1) != '/') $tmp .= '/';
160
  if (substr($tmp, strlen($tmp)-1, 1) != '/') $tmp .= '/';
161
  return $tmp;
161
  return $tmp;
162
}
162
}
163
 
163
 
164
function string2hex($str)
164
function string2hex($str)
165
{
165
{
166
  if (trim($str) != "")
166
  if (trim($str) != "")
167
  {
167
  {
168
    $hex = "";
168
    $hex = "";
169
    $length = strlen($str);
169
    $length = strlen($str);
170
    for ($i=0; $i<$length; $i++)
170
    for ($i=0; $i<$length; $i++)
171
    {
171
    {
172
      $hex .= str_pad(dechex(ord($str[$i])), 2, 0, STR_PAD_LEFT);
172
      $hex .= str_pad(dechex(ord($str[$i])), 2, 0, STR_PAD_LEFT);
173
    }
173
    }
174
    return $hex;
174
    return $hex;
175
  }
175
  }
176
}
176
}
177
 
177
 
178
function hex2string($hex)
178
function hex2string($hex)
179
{
179
{
180
  $string = '';
180
  $string = '';
181
 
181
 
182
  $hex = str_replace(array("\n","\r"," "), "", $hex);
182
  $hex = str_replace(array("\n","\r"," "), "", $hex);
183
 
183
 
184
  for ($ix=0; $ix < strlen($hex); $ix=$ix+2)
184
  for ($ix=0; $ix < strlen($hex); $ix=$ix+2)
185
  {
185
  {
186
    $ord = hexdec(substr($hex, $ix, 2));
186
    $ord = hexdec(substr($hex, $ix, 2));
187
    $string .= chr($ord);
187
    $string .= chr($ord);
188
  }
188
  }
189
 
189
 
190
  return $string;
190
  return $string;
191
}
191
}
192
 
192
 
193
// http://lists.phpbar.de/pipermail/php/Week-of-Mon-20040322/007749.html
193
// http://lists.phpbar.de/pipermail/php/Week-of-Mon-20040322/007749.html
194
 
194
 
195
function fetchip()
195
function fetchip()
196
{
196
{
197
  $client_ip = (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : '';
197
  $client_ip = (isset($_SERVER['HTTP_CLIENT_IP'])) ? $_SERVER['HTTP_CLIENT_IP'] : '';
198
  $x_forwarded_for = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
198
  $x_forwarded_for = (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : '';
199
  $remote_addr = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : '';
199
  $remote_addr = (isset($_SERVER['REMOTE_ADDR'])) ? $_SERVER['REMOTE_ADDR'] : '';
200
 
200
 
201
  if (!empty($client_ip))
201
  if (!empty($client_ip))
202
  {
202
  {
203
    $ip_expl = explode('.',$client_ip);
203
    $ip_expl = explode('.',$client_ip);
204
    $referer = explode('.',$remote_addr);
204
    $referer = explode('.',$remote_addr);
205
    if($referer[0] != $ip_expl[0])
205
    if($referer[0] != $ip_expl[0])
206
    {
206
    {
207
      $ip=array_reverse($ip_expl);
207
      $ip=array_reverse($ip_expl);
208
      $return=implode('.',$ip);
208
      $return=implode('.',$ip);
209
    }
209
    }
210
    else
210
    else
211
    {
211
    {
212
      $return = $client_ip;
212
      $return = $client_ip;
213
    }
213
    }
214
  }
214
  }
215
  else if (!empty($x_forwarded_for))
215
  else if (!empty($x_forwarded_for))
216
  {
216
  {
217
    if(strstr($x_forwarded_for,','))
217
    if(strstr($x_forwarded_for,','))
218
    {
218
    {
219
      $ip_expl = explode(',',$x_forwarded_for);
219
      $ip_expl = explode(',',$x_forwarded_for);
220
      $return = end($ip_expl);
220
      $return = end($ip_expl);
221
    }
221
    }
222
    else
222
    else
223
    {
223
    {
224
      $return = $x_forwarded_for;
224
      $return = $x_forwarded_for;
225
    }
225
    }
226
  }
226
  }
227
  else
227
  else
228
  {
228
  {
229
    $return = $remote_addr;
229
    $return = $remote_addr;
230
  }
230
  }
231
  unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl);
231
  unset ($client_ip, $x_forwarded_for, $remote_addr, $ip_expl);
232
  return $return;
232
  return $return;
233
}
233
}
234
 
234
 
235
// http://de.php.net/manual/de/function.fsockopen.php#73581
235
// http://de.php.net/manual/de/function.fsockopen.php#73581
236
// http://de.php.net/manual/de/function.fsockopen.php#75175
236
// http://de.php.net/manual/de/function.fsockopen.php#75175
237
 
237
 
238
function decode_header ( $str )
238
function decode_header ( $str )
239
{
239
{
240
    $part = preg_split ( "/\r?\n/", $str, -1, PREG_SPLIT_NO_EMPTY );
240
    $part = preg_split ( "/\r?\n/", $str, -1, PREG_SPLIT_NO_EMPTY );
241
    $out = array ();
241
    $out = array ();
242
 
242
 
243
    for ( $h = 0; $h < sizeof ( $part ); $h++ )
243
    for ( $h = 0; $h < sizeof ( $part ); $h++ )
244
    {
244
    {
245
        if ( $h != 0 )
245
        if ( $h != 0 )
246
        {
246
        {
247
            $pos = strpos ( $part[$h], ':' );
247
            $pos = strpos ( $part[$h], ':' );
248
            $k = strtolower ( str_replace ( ' ', '', substr ( $part[$h], 0, $pos ) ) );
248
            $k = strtolower ( str_replace ( ' ', '', substr ( $part[$h], 0, $pos ) ) );
249
            $v = trim ( substr ( $part[$h], ( $pos + 1 ) ) );
249
            $v = trim ( substr ( $part[$h], ( $pos + 1 ) ) );
250
        }
250
        }
251
        else
251
        else
252
        {
252
        {
253
            $k = 'status';
253
            $k = 'status';
254
            $v = explode ( ' ', $part[$h] );
254
            $v = explode ( ' ', $part[$h] );
255
            $v = $v[1];
255
            $v = $v[1];
256
        }
256
        }
257
 
257
 
258
        if ($k == '') break; // Zusatz von Personal WebBase
258
        if ($k == '') break; // Zusatz von Personal WebBase
259
 
259
 
260
        if ( $k == 'set-cookie' )
260
        if ( $k == 'set-cookie' )
261
        {
261
        {
262
                $out['cookies'][] = $v;
262
                $out['cookies'][] = $v;
263
        }
263
        }
264
        else if ( $k == 'content-type' )
264
        else if ( $k == 'content-type' )
265
        {
265
        {
266
            if ( ( $cs = strpos ( $v, ';' ) ) !== false )
266
            if ( ( $cs = strpos ( $v, ';' ) ) !== false )
267
            {
267
            {
268
                $out[$k] = substr ( $v, 0, $cs );
268
                $out[$k] = substr ( $v, 0, $cs );
269
            }
269
            }
270
            else
270
            else
271
            {
271
            {
272
                $out[$k] = $v;
272
                $out[$k] = $v;
273
            }
273
            }
274
        }
274
        }
275
        else
275
        else
276
        {
276
        {
277
            $out[$k] = $v;
277
            $out[$k] = $v;
278
        }
278
        }
279
    }
279
    }
280
 
280
 
281
    return $out;
281
    return $out;
282
}
282
}
283
 
283
 
284
function decode_body ( $info, $str, $eol = "\r\n" )
284
function decode_body ( $info, $str, $eol = "\r\n" )
285
{
285
{
286
  $tmp = $str;
286
  $tmp = $str;
287
  $add = strlen ( $eol );
287
  $add = strlen ( $eol );
288
  $str = '';
288
  $str = '';
289
  if ( isset ( $info['transfer-encoding'] ) && $info['transfer-encoding'] == 'chunked' )
289
  if ( isset ( $info['transfer-encoding'] ) && $info['transfer-encoding'] == 'chunked' )
290
  {
290
  {
291
    do
291
    do
292
    {
292
    {
293
      $tmp = ltrim ( $tmp );
293
      $tmp = ltrim ( $tmp );
294
      $pos = strpos ( $tmp, $eol );
294
      $pos = strpos ( $tmp, $eol );
295
      $len = hexdec ( substr ( $tmp, 0, $pos ) );
295
      $len = hexdec ( substr ( $tmp, 0, $pos ) );
296
      if ( isset ( $info['content-encoding'] ) )
296
      if ( isset ( $info['content-encoding'] ) )
297
      {
297
      {
298
        $str .= gzinflate ( substr ( $tmp, ( $pos + $add + 10 ), $len ) );
298
        $str .= gzinflate ( substr ( $tmp, ( $pos + $add + 10 ), $len ) );
299
      }
299
      }
300
      else
300
      else
301
      {
301
      {
302
        $str .= substr ( $tmp, ( $pos + $add ), $len );
302
        $str .= substr ( $tmp, ( $pos + $add ), $len );
303
      }
303
      }
304
 
304
 
305
      $tmp = substr ( $tmp, ( $len + $pos + $add ) );
305
      $tmp = substr ( $tmp, ( $len + $pos + $add ) );
306
      $check = trim ( $tmp );
306
      $check = trim ( $tmp );
307
    }
307
    }
308
    while ( ! empty ( $check ) );
308
    while ( ! empty ( $check ) );
309
  }
309
  }
310
  else if ( isset ( $info['content-encoding'] ) )
310
  else if ( isset ( $info['content-encoding'] ) )
311
  {
311
  {
312
    $str = gzinflate ( substr ( $tmp, 10 ) );
312
    $str = gzinflate ( substr ( $tmp, 10 ) );
313
  }
313
  }
314
  else {
314
  else {
315
    $str = $tmp;
315
    $str = $tmp;
316
  }
316
  }
317
  return $str;
317
  return $str;
318
}
318
}
319
 
319
 
320
function url_protokoll_vorhanden($url)
320
function url_protokoll_vorhanden($url)
321
{
321
{
322
  $ary = explode('://', $url);
322
  $ary = explode('://', $url);
323
  return ((strpos($ary[0], '/') === false) && (isset($ary[1])));
323
  return ((strpos($ary[0], '/') === false) && (isset($ary[1])));
324
}
324
}
325
 
325
 
326
function my_get_contents($url, $show_errors = false, $ignore_status_code = false, $time_out = 10, $umleitung_limit = 50, $umleitung_count = 0)
326
function my_get_contents($url, $show_errors = false, $ignore_status_code = false, $time_out = 10, $umleitung_limit = 50, $umleitung_count = 0)
327
{
327
{
328
  if (!url_protokoll_vorhanden($url)) $url = 'http://'.$url;
328
  if (!url_protokoll_vorhanden($url)) $url = 'http://'.$url;
329
 
329
 
330
  if (!inetconn_ok())
330
  if (!inetconn_ok())
331
  {
331
  {
332
    if ($show_errors)
332
    if ($show_errors)
333
    {
333
    {
334
      echo '<b>Fehler:</b> my_get_contents('.$url.'): Es existiert keine Internetverbindung.<br>';
334
      echo '<b>Fehler:</b> my_get_contents('.$url.'): Es existiert keine Internetverbindung.<br>';
335
    }
335
    }
336
    return false;
336
    return false;
337
  }
337
  }
338
 
338
 
339
  // Jetzt reichts abba...
339
  // Jetzt reichts abba...
340
  if ($umleitung_count > $umleitung_limit)
340
  if ($umleitung_count > $umleitung_limit)
341
  {
341
  {
342
    if ($show_errors)
342
    if ($show_errors)
343
    {
343
    {
344
      echo '<b>Fehler:</b> my_get_contents('.$url.'): Umleitungslimit von 50 erreicht.<br>';
344
      echo '<b>Fehler:</b> my_get_contents('.$url.'): Umleitungslimit von 50 erreicht.<br>';
345
    }
345
    }
346
    return false;
346
    return false;
347
  }
347
  }
348
 
348
 
349
  // URL splitten
349
  // URL splitten
350
  $ary = explode('://', $url);
350
  $ary = explode('://', $url);
351
  $cry = explode('/', $ary[1]);
351
  $cry = explode('/', $ary[1]);
352
  $bry = explode(':', $cry[0]);
352
  $bry = explode(':', $cry[0]);
353
 
353
 
354
  // Host festlegen
354
  // Host festlegen
355
  $ssl = '';
355
  $ssl = '';
356
  $host = $bry[0];
356
  $host = $bry[0];
357
 
357
 
358
  // Port festlegen und ggf. SSL-Präfix setzen
358
  // Port festlegen und ggf. SSL-Präfix setzen
359
  if (isset($bry[1]))
359
  if (isset($bry[1]))
360
  {
360
  {
361
    $port = $bry[1];
361
    $port = $bry[1];
362
  }
362
  }
363
  else
363
  else
364
  {
364
  {
365
    if ($ary[0] == 'ftp')
365
    if ($ary[0] == 'ftp')
366
    {
366
    {
367
      $port = 21;
367
      $port = 21;
368
    }
368
    }
369
    if ($ary[0] == 'http')
369
    if ($ary[0] == 'http')
370
    {
370
    {
371
      $port = 80;
371
      $port = 80;
372
    }
372
    }
373
    else if ($ary[0] == 'https')
373
    else if ($ary[0] == 'https')
374
    {
374
    {
375
      $ssl = 'ssl://';
375
      $ssl = 'ssl://';
376
      $port = 443;
376
      $port = 443;
377
    }
377
    }
378
    else
378
    else
379
    {
379
    {
380
      $port = 80; // Problem
380
      $port = 80; // Problem
381
    }
381
    }
382
  }
382
  }
383
 
383
 
384
  // Request-String festlegen
384
  // Request-String festlegen
385
  $req = '';
385
  $req = '';
386
  for ($i=1; isset($cry[$i]); $i++)
386
  for ($i=1; isset($cry[$i]); $i++)
387
  {
387
  {
388
    $req .= '/'.$cry[$i];
388
    $req .= '/'.$cry[$i];
389
  }
389
  }
390
  if ($req == '') $req = '/';
390
  if ($req == '') $req = '/';
391
 
391
 
392
  // User-Agent = Personal WebBase
392
  // User-Agent = Personal WebBase
393
  $revision = '???';
393
  $revision = '???';
394
  if (file_exists('includes/rev.inc.php')) include('includes/rev.inc.php');
394
  if (file_exists('includes/rev.inc.php')) include('includes/rev.inc.php');
395
  $uagent = 'ViaThinkSoft-Personal WebBase/'.$revision;
395
  $uagent = 'ViaThinkSoft-Personal WebBase/'.$revision;
396
 
396
 
397
  // Anfrage starten
397
  // Anfrage starten
398
  $fp = @fsockopen($ssl.$host, $port, $errno, $errstr, $time_out);
398
  $fp = @fsockopen($ssl.$host, $port, $errno, $errstr, $time_out);
399
  if (!$fp)
399
  if (!$fp)
400
  {
400
  {
401
    if ($show_errors)
401
    if ($show_errors)
402
    {
402
    {
403
      echo '<b>Fehler:</b> my_get_contents('.$url.'): Fehler beim &ouml;ffnen des Sockets - '.$errstr.' ('.$errno.')<br>';
403
      echo '<b>Fehler:</b> my_get_contents('.$url.'): Fehler beim &ouml;ffnen des Sockets - '.$errstr.' ('.$errno.')<br>';
404
    }
404
    }
405
    return false;
405
    return false;
406
  }
406
  }
407
  else
407
  else
408
  {
408
  {
409
    $tmp = '';
409
    $tmp = '';
410
    @fputs ($fp, "GET $req HTTP/1.1\r\nHost: $host\r\nConnection: close\r\nUser-Agent: $uagent\r\n\r\n");
410
    @fputs ($fp, "GET $req HTTP/1.1\r\nHost: $host\r\nConnection: close\r\nUser-Agent: $uagent\r\n\r\n");
411
    while (!@feof($fp))
411
    while (!@feof($fp))
412
    {
412
    {
413
      $tmp .= @fgets($fp,128);
413
      $tmp .= @fgets($fp,128);
414
    }
414
    }
415
    @fclose($fp);
415
    @fclose($fp);
416
 
416
 
417
    $info = decode_header($tmp);
417
    $info = decode_header($tmp);
418
 
418
 
419
    // Fehler?
419
    // Fehler?
420
    if ((!$ignore_status_code) && (isset($info['status'])) && ($info['status'] >= 400))
420
    if ((!$ignore_status_code) && (isset($info['status'])) && ($info['status'] >= 400))
421
    {
421
    {
422
      if ($show_errors)
422
      if ($show_errors)
423
      {
423
      {
424
        echo '<b>Fehler:</b> my_get_contents('.$url.'): HTTP-Status-Code '.$info['status'].'<br>';
424
        echo '<b>Fehler:</b> my_get_contents('.$url.'): HTTP-Status-Code '.$info['status'].'<br>';
425
      }
425
      }
426
      return false;
426
      return false;
427
    }
427
    }
428
 
428
 
429
    // Umleitung vorhanden?
429
    // Umleitung vorhanden?
430
    if ((isset($info['location'])) && ($info['location'] != ''))
430
    if ((isset($info['location'])) && ($info['location'] != ''))
431
    {
431
    {
432
      if (strpos($info['location'], '://') !== false)
432
      if (strpos($info['location'], '://') !== false)
433
      {
433
      {
434
        // 1. Fall: http://www.example.com/test.php
434
        // 1. Fall: http://www.example.com/test.php
435
 
435
 
436
        return my_get_contents($info['location'], $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
436
        return my_get_contents($info['location'], $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
437
      }
437
      }
438
      else if (substr($info['location'], 0, 2) == './')
438
      else if (substr($info['location'], 0, 2) == './')
439
      {
439
      {
440
        // 2. Fall: ./test.php
440
        // 2. Fall: ./test.php
441
 
441
 
442
        if (substr($req, strlen($req)-1, 1) != '/')
442
        if (substr($req, strlen($req)-1, 1) != '/')
443
        {
443
        {
444
          // Entweder ein Verzeichnis ohne / am Ende oder eine Datei
444
          // Entweder ein Verzeichnis ohne / am Ende oder eine Datei
445
          // Letztes Element muss abgeschnitten werden
445
          // Letztes Element muss abgeschnitten werden
446
          $x = '';
446
          $x = '';
447
          $gry = explode('/', $req);
447
          $gry = explode('/', $req);
448
          for ($j=1; isset($gry[$j+1]); $j++)
448
          for ($j=1; isset($gry[$j+1]); $j++)
449
          {
449
          {
450
            $x .= '/'.$gry[$j];
450
            $x .= '/'.$gry[$j];
451
          }
451
          }
452
          $x .= '/';
452
          $x .= '/';
453
        }
453
        }
454
        else
454
        else
455
        {
455
        {
456
          $x = $req;
456
          $x = $req;
457
        }
457
        }
458
        $x .= substr($info['location'], 2, strlen($info['location'])-2);
458
        $x .= substr($info['location'], 2, strlen($info['location'])-2);
459
 
459
 
460
        return my_get_contents($ary[0].'://'.$host.$x, $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
460
        return my_get_contents($ary[0].'://'.$host.$x, $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
461
      }
461
      }
462
      else if (substr($info['location'], 0, 1) == '/')
462
      else if (substr($info['location'], 0, 1) == '/')
463
      {
463
      {
464
        // 3. Fall: /test.php
464
        // 3. Fall: /test.php
465
 
465
 
466
        $x = $info['location'];
466
        $x = $info['location'];
467
 
467
 
468
        return my_get_contents($ary[0].'://'.$host.$x, $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
468
        return my_get_contents($ary[0].'://'.$host.$x, $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
469
      }
469
      }
470
      else
470
      else
471
      {
471
      {
472
        // 4. Fall: test.php (= ./test.php)
472
        // 4. Fall: test.php (= ./test.php)
473
 
473
 
474
        $x = $req;
474
        $x = $req;
475
        if (substr($req, strlen($req)-1, 1) != '/')
475
        if (substr($req, strlen($req)-1, 1) != '/')
476
        {
476
        {
477
          // Entweder ein Verzeichnis ohne / am Ende oder eine Datei
477
          // Entweder ein Verzeichnis ohne / am Ende oder eine Datei
478
          // Letztes Element muss abgeschnitten werden
478
          // Letztes Element muss abgeschnitten werden
479
          $x = '';
479
          $x = '';
480
          $gry = explode('/', $req);
480
          $gry = explode('/', $req);
481
          for ($j=1; isset($gry[$j+1]); $j++)
481
          for ($j=1; isset($gry[$j+1]); $j++)
482
          {
482
          {
483
            $x .= '/'.$gry[$j];
483
            $x .= '/'.$gry[$j];
484
          }
484
          }
485
          $x .= '/';
485
          $x .= '/';
486
        }
486
        }
487
        else
487
        else
488
        {
488
        {
489
          $x = $req;
489
          $x = $req;
490
        }
490
        }
491
        $x .= $info['location'];
491
        $x .= $info['location'];
492
 
492
 
493
        return my_get_contents($ary[0].'://'.$host.$x, $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
493
        return my_get_contents($ary[0].'://'.$host.$x, $show_errors, $ignore_status_code, $time_out, $umleitung_limit, $umleitung_count+1);
494
      }
494
      }
495
    }
495
    }
496
 
496
 
497
    // Content filtern
497
    // Content filtern
498
    $con = explode("\r\n\r\n", $tmp);
498
    $con = explode("\r\n\r\n", $tmp);
499
    $tmp = '';
499
    $tmp = '';
500
    for ($i=1; isset($con[$i]); $i++)
500
    for ($i=1; isset($con[$i]); $i++)
501
    {
501
    {
502
      $tmp .= $con[$i];
502
      $tmp .= $con[$i];
503
      if (isset($con[$i+1])) $tmp .= "\r\n\r\n";
503
      if (isset($con[$i+1])) $tmp .= "\r\n\r\n";
504
    }
504
    }
505
 
505
 
506
    return decode_body ( $info, $tmp );
506
    return decode_body ( $info, $tmp );
507
  }
507
  }
508
}
508
}
509
 
509
 
510
function my_htmlentities($inp, $charset = 'iso-8859-1')
510
function my_htmlentities($inp, $charset = 'iso-8859-1')
511
{
511
{
512
  // http://www.php.net/manual/de/function.htmlspecialchars.php
512
  // http://www.php.net/manual/de/function.htmlspecialchars.php
513
  // PHP-Version wird nicht kontrolliert...
513
  // PHP-Version wird nicht kontrolliert...
514
  $cs = 'utf-8';
514
  $cs = 'utf-8';
515
 
515
 
516
  if (strtolower($charset) == 'iso-8859-1') $cs = 'ISO-8859-1';
516
  if (strtolower($charset) == 'iso-8859-1') $cs = 'ISO-8859-1';
517
  if (strtolower($charset) == 'iso8859-1') $cs = 'ISO-8859-1';
517
  if (strtolower($charset) == 'iso8859-1') $cs = 'ISO-8859-1';
518
  if (strtolower($charset) == 'iso-8859-15') $cs = 'ISO-8859-15';
518
  if (strtolower($charset) == 'iso-8859-15') $cs = 'ISO-8859-15';
519
  if (strtolower($charset) == 'iso8859-15') $cs = 'ISO-8859-15';
519
  if (strtolower($charset) == 'iso8859-15') $cs = 'ISO-8859-15';
520
  if (strtolower($charset) == 'utf-8') $cs = 'UTF-8';
520
  if (strtolower($charset) == 'utf-8') $cs = 'UTF-8';
521
  if (strtolower($charset) == 'cp866') $cs = 'cp866';
521
  if (strtolower($charset) == 'cp866') $cs = 'cp866';
522
  if (strtolower($charset) == 'ibm866') $cs = 'cp866';
522
  if (strtolower($charset) == 'ibm866') $cs = 'cp866';
523
  if (strtolower($charset) == '866') $cs = 'cp866';
523
  if (strtolower($charset) == '866') $cs = 'cp866';
524
  if (strtolower($charset) == 'cp1251') $cs = 'cp1251';
524
  if (strtolower($charset) == 'cp1251') $cs = 'cp1251';
525
  if (strtolower($charset) == 'windows-1251') $cs = 'cp1251';
525
  if (strtolower($charset) == 'windows-1251') $cs = 'cp1251';
526
  if (strtolower($charset) == 'win-1251') $cs = 'cp1251';
526
  if (strtolower($charset) == 'win-1251') $cs = 'cp1251';
527
  if (strtolower($charset) == '1251') $cs = 'cp1251';
527
  if (strtolower($charset) == '1251') $cs = 'cp1251';
528
  if (strtolower($charset) == 'cp1252') $cs = 'cp1252';
528
  if (strtolower($charset) == 'cp1252') $cs = 'cp1252';
529
  if (strtolower($charset) == 'windows-1252') $cs = 'cp1252';
529
  if (strtolower($charset) == 'windows-1252') $cs = 'cp1252';
530
  if (strtolower($charset) == '1252') $cs = 'cp1252';
530
  if (strtolower($charset) == '1252') $cs = 'cp1252';
531
  if (strtolower($charset) == 'koi8-r') $cs = 'KOI8-R';
531
  if (strtolower($charset) == 'koi8-r') $cs = 'KOI8-R';
532
  if (strtolower($charset) == 'koi8-ru') $cs = 'KOI8-R';
532
  if (strtolower($charset) == 'koi8-ru') $cs = 'KOI8-R';
533
  if (strtolower($charset) == 'koi8r') $cs = 'KOI8-R';
533
  if (strtolower($charset) == 'koi8r') $cs = 'KOI8-R';
534
  if (strtolower($charset) == 'big5') $cs = 'BIG5';
534
  if (strtolower($charset) == 'big5') $cs = 'BIG5';
535
  if (strtolower($charset) == '950') $cs = 'BIG5';
535
  if (strtolower($charset) == '950') $cs = 'BIG5';
536
  if (strtolower($charset) == 'gb2312') $cs = 'GB2312';
536
  if (strtolower($charset) == 'gb2312') $cs = 'GB2312';
537
  if (strtolower($charset) == '936') $cs = 'GB2312';
537
  if (strtolower($charset) == '936') $cs = 'GB2312';
538
  if (strtolower($charset) == 'big5-hkscs') $cs = 'BIG5-HKSCS';
538
  if (strtolower($charset) == 'big5-hkscs') $cs = 'BIG5-HKSCS';
539
  if (strtolower($charset) == 'shift_jis') $cs = 'Shift_JIS';
539
  if (strtolower($charset) == 'shift_jis') $cs = 'Shift_JIS';
540
  if (strtolower($charset) == 'sjis') $cs = 'Shift_JIS';
540
  if (strtolower($charset) == 'sjis') $cs = 'Shift_JIS';
541
  if (strtolower($charset) == '932') $cs = 'Shift_JIS';
541
  if (strtolower($charset) == '932') $cs = 'Shift_JIS';
542
  if (strtolower($charset) == 'euc-jp') $cs = 'EUC-JP';
542
  if (strtolower($charset) == 'euc-jp') $cs = 'EUC-JP';
543
  if (strtolower($charset) == 'eucjp') $cs = 'EUC-JP';
543
  if (strtolower($charset) == 'eucjp') $cs = 'EUC-JP';
544
 
544
 
545
  return @htmlentities($inp, ENT_NOQUOTES, $cs);
545
  return @htmlentities($inp, ENT_NOQUOTES, $cs);
546
}
546
}
547
 
547
 
548
function check_email($email_adresse)
548
function check_email($email_adresse)
549
{
549
{
550
  return preg_match("/^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$/",$email_adresse);
550
  return preg_match("/^[_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,4}$/",$email_adresse);
551
}
551
}
552
 
552
 
553
function return_bytes($val)
553
function return_bytes($val)
554
{
554
{
555
  $val = trim($val);
555
  $val = trim($val);
556
  if (is_numeric($val)) return $val;
556
  if (is_numeric($val)) return $val;
557
  $last = strtolower($val[strlen($val)-1]);
557
  $last = strtolower($val[strlen($val)-1]);
558
  $val = substr($val,0,strlen($val)-1);
558
  $val = substr($val,0,strlen($val)-1);
559
  switch($last)
559
  switch($last)
560
  {
560
  {
561
    case 'g':
561
    case 'g':
562
      $val *= 1024;
562
      $val *= 1024;
563
      /* ... falls through ... */
563
      /* ... falls through ... */
564
    case 'm':
564
    case 'm':
565
      $val *= 1024;
565
      $val *= 1024;
566
      /* ... falls through ... */
566
      /* ... falls through ... */
567
    case 'k':
567
    case 'k':
568
      $val *= 1024;
568
      $val *= 1024;
569
      /* ... falls through ... */
569
      /* ... falls through ... */
570
  }
570
  }
571
  return $val;
571
  return $val;
572
}
572
}
573
 
573
 
574
function zufall($size)
574
function zufall($size)
575
{
575
{
576
  $result = "";
576
  $result = "";
577
 
577
 
578
  srand((double)microtime()*1000000);
578
  srand((double)microtime()*1000000);
579
 
579
 
580
   for($i=0; $i < $size; $i++)
580
   for($i=0; $i < $size; $i++)
581
  {
581
  {
582
    $num = rand(48,120);
582
    $num = rand(48,120);
583
    while (($num >= 58 && $num <= 64) || ($num >= 91 && $num <= 96))
583
    while (($num >= 58 && $num <= 64) || ($num >= 91 && $num <= 96))
584
       $num = rand(48,120);
584
       $num = rand(48,120);
585
 
585
 
586
    $result .= chr($num);
586
    $result .= chr($num);
587
  }
587
  }
588
  return $result;
588
  return $result;
589
}
589
}
590
 
590
 
591
function runden($inp, $nachkommastellen = 0)
591
function runden($inp, $nachkommastellen = 0)
592
{
592
{
593
  return number_format($inp, $nachkommastellen, ",", ".");
593
  return number_format($inp, $nachkommastellen, ",", ".");
594
}
594
}
595
 
595
 
596
// PHP-AntiSpam-Funktion "secure_email", Version 3.0
596
// PHP-AntiSpam-Funktion "secure_email", Version 3.0
597
// von Daniel Marschall [www.daniel-marschall.de]
597
// von Daniel Marschall [www.daniel-marschall.de]
598
 
598
 
599
function secure_email($email, $linktext, $crypt_linktext)
599
function secure_email($email, $linktext, $crypt_linktext)
600
{
600
{
601
  if (!function_exists('alas_js_crypt'))
601
  if (!function_exists('alas_js_crypt'))
602
  {
602
  {
603
    function alas_js_crypt($text)
603
    function alas_js_crypt($text)
604
    {
604
    {
605
      $tmp = '';
605
      $tmp = '';
606
      for ($i=0; $i<strlen($text); $i++)
606
      for ($i=0; $i<strlen($text); $i++)
607
      {
607
      {
608
        $tmp .= 'document.write("&#'.ord(substr($text, $i, 1)).';");';
608
        $tmp .= 'document.write("&#'.ord(substr($text, $i, 1)).';");';
609
      }
609
      }
610
      return $tmp;
610
      return $tmp;
611
    }
611
    }
612
  }
612
  }
613
 
613
 
614
  if (!function_exists('alas_js_write'))
614
  if (!function_exists('alas_js_write'))
615
  {
615
  {
616
    function alas_js_write($text)
616
    function alas_js_write($text)
617
    {
617
    {
618
      $text = str_replace('\\', '\\\\', $text);
618
      $text = str_replace('\\', '\\\\', $text);
619
      $text = str_replace('"', '\"', $text);
619
      $text = str_replace('"', '\"', $text);
620
      return 'document.write("'.$text.'");';
620
      return 'document.write("'.$text.'");';
621
    }
621
    }
622
  }
622
  }
623
 
623
 
624
  $aus = '';
624
  $aus = '';
625
  if ($email != '')
625
  if ($email != '')
626
  {
626
  {
627
    $aus .= '<script language="JavaScript" type="text/javascript"><!--'."\n";
627
    $aus .= '<script language="JavaScript" type="text/javascript"><!--'."\n";
628
    $aus .= alas_js_write('<a href="');
628
    $aus .= alas_js_write('<a href="');
629
    $aus .= alas_js_crypt('mailto:'.$email);
629
    $aus .= alas_js_crypt('mailto:'.$email);
630
    $aus .= alas_js_write('">');
630
    $aus .= alas_js_write('">');
631
    $aus .= $crypt_linktext ? alas_js_crypt($linktext) : alas_js_write($linktext);
631
    $aus .= $crypt_linktext ? alas_js_crypt($linktext) : alas_js_write($linktext);
632
    $aus .= alas_js_write('</a>').'// --></script>';
632
    $aus .= alas_js_write('</a>').'// --></script>';
633
  }
633
  }
634
  return $aus;
634
  return $aus;
635
}
635
}
636
 
636
 
637
function de_convertmysqldatetime($datum, $zeige_sekunden = false)
637
function de_convertmysqldatetime($datum, $zeige_sekunden = false)
638
{
638
{
639
  if (($datum == '') || ($datum == '0000-00-00 00:00:00'))
639
  if (($datum == '') || ($datum == '0000-00-00 00:00:00'))
640
  {
640
  {
641
        return 'Unbekannt';
641
        return 'Unbekannt';
642
  }
642
  }
643
  else
643
  else
644
  {
644
  {
645
 
645
 
646
        $date = explode(" ", $datum);
646
        $date = explode(" ", $datum);
647
    $ddatum = explode("-", $date[0]);
647
    $ddatum = explode("-", $date[0]);
648
    if (isset($date[1]))
648
    if (isset($date[1]))
649
    {
649
    {
650
      $date = explode(":", $date[1]);
650
      $date = explode(":", $date[1]);
651
    }
651
    }
652
    else
652
    else
653
    {
653
    {
654
      $date[0] = '';
654
      $date[0] = '';
655
      $date[1] = '';
655
      $date[1] = '';
656
      $date[2] = '';
656
      $date[2] = '';
657
    }
657
    }
658
 
658
 
659
 
659
 
660
    if ($ddatum[1] == '01') $mon = 'Januar';
660
    if ($ddatum[1] == '01') $mon = 'Januar';
661
    if ($ddatum[1] == '02') $mon = 'Februar';
661
    if ($ddatum[1] == '02') $mon = 'Februar';
662
    if ($ddatum[1] == '03') $mon = 'M&auml;rz';
662
    if ($ddatum[1] == '03') $mon = 'M&auml;rz';
663
    if ($ddatum[1] == '04') $mon = 'April';
663
    if ($ddatum[1] == '04') $mon = 'April';
664
    if ($ddatum[1] == '05') $mon = 'Mai';
664
    if ($ddatum[1] == '05') $mon = 'Mai';
665
    if ($ddatum[1] == '06') $mon = 'Juni';
665
    if ($ddatum[1] == '06') $mon = 'Juni';
666
    if ($ddatum[1] == '07') $mon = 'Juli';
666
    if ($ddatum[1] == '07') $mon = 'Juli';
667
    if ($ddatum[1] == '08') $mon = 'August';
667
    if ($ddatum[1] == '08') $mon = 'August';
668
    if ($ddatum[1] == '09') $mon = 'September';
668
    if ($ddatum[1] == '09') $mon = 'September';
669
    if ($ddatum[1] == '10') $mon = 'Oktober';
669
    if ($ddatum[1] == '10') $mon = 'Oktober';
670
    if ($ddatum[1] == '11') $mon = 'November';
670
    if ($ddatum[1] == '11') $mon = 'November';
671
    if ($ddatum[1] == '12') $mon = 'Dezember';
671
    if ($ddatum[1] == '12') $mon = 'Dezember';
672
    $tag = sprintf("%d",$ddatum[2]);
672
    $tag = sprintf("%d",$ddatum[2]);
673
    $datum = $tag.". ".$mon." ".$ddatum[0];
673
    $datum = $tag.". ".$mon." ".$ddatum[0];
674
 
674
 
675
    if (($date[0] != '') && ($date[1] != ''))
675
    if (($date[0] != '') && ($date[1] != ''))
676
    {
676
    {
677
      if ($zeige_sekunden) $zus = ':'.$date[2]; else $zus = '';
677
      if ($zeige_sekunden) $zus = ':'.$date[2]; else $zus = '';
678
      return $datum.', '.$date[0].':'.$date[1].$zus.' Uhr';
678
      return $datum.', '.$date[0].':'.$date[1].$zus.' Uhr';
679
    }
679
    }
680
    else
680
    else
681
      return $datum;
681
      return $datum;
682
  }
682
  }
683
}
683
}
684
 
684
 
685
function zwischen_url($url, $von, $bis, $flankierungen_miteinbeziehen = true)
685
function zwischen_url($url, $von, $bis, $flankierungen_miteinbeziehen = true)
686
{
686
{
687
  return zwischen_str(my_get_contents($url), $von, $bis, $flankierungen_miteinbeziehen);
687
  return zwischen_str(my_get_contents($url), $von, $bis, $flankierungen_miteinbeziehen);
688
}
688
}
689
 
689
 
690
function zwischen_str($str, $von, $bis, $flankierungen_miteinbeziehen = true)
690
function zwischen_str($str, $von, $bis, $flankierungen_miteinbeziehen = true)
691
{
691
{
692
  $ausgabe = $str;
692
  $ausgabe = $str;
693
 
693
 
694
  if ($von != '')
694
  if ($von != '')
695
  {
695
  {
696
    $pos = strpos($ausgabe, $von);
696
    $pos = strpos($ausgabe, $von);
697
    if ($pos !== false)
697
    if ($pos !== false)
698
    {
698
    {
699
      $ausgabe = substr($ausgabe, $pos, strlen($ausgabe)-$pos);
699
      $ausgabe = substr($ausgabe, $pos, strlen($ausgabe)-$pos);
700
      if (!$flankierungen_miteinbeziehen)
700
      if (!$flankierungen_miteinbeziehen)
701
        $ausgabe = substr($ausgabe, strlen($von), strlen($ausgabe)-strlen($von)-1); // -1 ?
701
        $ausgabe = substr($ausgabe, strlen($von), strlen($ausgabe)-strlen($von)-1); // -1 ?
702
    }
702
    }
703
  }
703
  }
704
 
704
 
705
  if ($bis != '')
705
  if ($bis != '')
706
  {
706
  {
707
    $pos = strpos($ausgabe, $bis);
707
    $pos = strpos($ausgabe, $bis);
708
    if ($pos !== false)
708
    if ($pos !== false)
709
    {
709
    {
710
      $ausgabe = substr($ausgabe, 0, $pos+strlen($bis));
710
      $ausgabe = substr($ausgabe, 0, $pos+strlen($bis));
711
      if (!$flankierungen_miteinbeziehen)
711
      if (!$flankierungen_miteinbeziehen)
712
        $ausgabe = substr($ausgabe, 0, strlen($ausgabe)-strlen($bis));
712
        $ausgabe = substr($ausgabe, 0, strlen($ausgabe)-strlen($bis));
713
    }
713
    }
714
  }
714
  }
715
 
715
 
716
  return $ausgabe;
716
  return $ausgabe;
717
}
717
}
718
 
718
 
719
//////////////////////////////////////////////////////////////////////////////
719
//////////////////////////////////////////////////////////////////////////////
720
// GFX/LISTE/OOP-FUNKTIONEN                                                 //
720
// GFX/LISTE/OOP-FUNKTIONEN                                                 //
721
//////////////////////////////////////////////////////////////////////////////
721
//////////////////////////////////////////////////////////////////////////////
722
 
722
 
723
function oop_link_to_modul($modul, $seite = 'inhalt', $titelzeile_modul = '')
723
function oop_link_to_modul($modul, $seite = 'inhalt', $titelzeile_modul = '')
724
{
724
{
725
  $titel = $modul;
725
  $titel = $modul;
726
 
726
 
727
  $modulueberschrift = '';
727
  $modulueberschrift = '';
728
  $modulsekpos = '';
728
  $modulsekpos = '';
729
  $modulpos = '';
729
  $modulpos = '';
730
  $modulrechte = '';
730
  $modulrechte = '';
731
  $autor = '';
731
  $autor = '';
732
  $version = '';
732
  $version = '';
733
  $menuevisible = '';
733
  $menuevisible = '';
734
  $license = '';
734
  $license = '';
735
  $deaktiviere_zugangspruefung = 0;
735
  $deaktiviere_zugangspruefung = 0;
736
 
736
 
737
  if ($titelzeile_modul == '') $titelzeile_modul = $modul;
737
  if ($titelzeile_modul == '') $titelzeile_modul = $modul;
738
 
738
 
739
  if (file_exists('modules/'.wb_dir_escape($titelzeile_modul).'/var.inc.php'))
739
  if (file_exists('modules/'.wb_dir_escape($titelzeile_modul).'/var.inc.php'))
740
  {
740
  {
741
    include('modules/'.wb_dir_escape($titelzeile_modul).'/var.inc.php');
741
    include('modules/'.wb_dir_escape($titelzeile_modul).'/var.inc.php');
742
    $titel = $modulueberschrift;
742
    $titel = $modulueberschrift;
743
  }
743
  }
744
 
744
 
745
  if (file_exists('modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.png'))
745
  if (file_exists('modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.png'))
746
    $g = 'modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.png';
746
    $g = 'modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.png';
747
  else if (file_exists('modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.gif'))
747
  else if (file_exists('modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.gif'))
748
    $g = 'modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.gif';
748
    $g = 'modules/'.wb_dir_escape($titelzeile_modul).'/images/menu/32.gif';
749
  else
749
  else
750
    $g = 'design/spacer.gif';
750
    $g = 'design/spacer.gif';
751
 
751
 
752
  return "javascript:oop('".$modul."', '".$seite."', '".my_htmlentities($titel)."', '".$g."');";
752
  return "javascript:oop('".$modul."', '".$seite."', '".my_htmlentities($titel)."', '".$g."');";
753
}
753
}
754
 
754
 
755
function liste_items($modul, $table, $append, $dir = 0)
755
function liste_items($modul, $table, $append, $dir = 0)
756
{
756
{
757
  global $benutzer;
757
  global $benutzer;
758
 
758
 
759
  if (!isset($erg)) $erg = array();
759
  if (!isset($erg)) $erg = array();
760
 
760
 
761
  $i = 0;
761
  $i = 0;
762
  $res = db_query("SELECT * FROM `$table` WHERE `folder` = '".db_escape($dir)."' AND `user` = '".$benutzer['id']."' $append");
762
  $res = db_query("SELECT * FROM `$table` WHERE `folder` = '".db_escape($dir)."' AND `user` = '".$benutzer['id']."' $append");
763
  while ($row = db_fetch($res))
763
  while ($row = db_fetch($res))
764
  {
764
  {
765
    $i++;
765
    $i++;
766
    $erg[$i] = $row;
766
    $erg[$i] = $row;
767
  }
767
  }
768
 
768
 
769
  return $erg;
769
  return $erg;
770
}
770
}
771
 
771
 
772
function liste_items_filter($modul, $table, $append)
772
function liste_items_filter($modul, $table, $append)
773
{
773
{
774
  $i = 0;
774
  $i = 0;
775
 
775
 
776
  $res = db_query("SELECT * FROM `$table` $append");
776
  $res = db_query("SELECT * FROM `$table` $append");
777
  while ($row = db_fetch($res))
777
  while ($row = db_fetch($res))
778
  {
778
  {
779
    $i++;
779
    $i++;
780
    $erg[$i] = $row;
780
    $erg[$i] = $row;
781
  }
781
  }
782
 
782
 
783
  return $erg;
783
  return $erg;
784
}
784
}
785
 
785
 
786
function gfx_begintable()
786
function wb_draw_table_begin()
787
{
787
{
788
  echo '<div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%">';
788
  echo '<div align="center"><table cellspacing="0" cellpadding="2" border="0" width="90%">';
789
}
789
}
790
 
790
 
791
function gfx_endtable()
791
function wb_draw_table_end()
792
{
792
{
793
  echo '</table></div><br>';
793
  echo '</table></div><br>';
794
}
794
}
795
 
795
 
796
function gfx_tablecontent()
796
function wb_draw_table_content()
797
{
797
{
798
  echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">';
798
  echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">';
799
  $j = 0;
799
  $j = 0;
800
  for ($i=0; $i < @func_num_args(); $i=$i+2)
800
  for ($i=0; $i < @func_num_args(); $i=$i+2)
801
  {
801
  {
802
    $j++;
802
    $j++;
803
    if (@func_get_arg($i) != '')
803
    if (@func_get_arg($i) != '')
804
          $w = 'width="'.@func_get_arg($i).'" ';
804
          $w = 'width="'.@func_get_arg($i).'" ';
805
        else
805
        else
806
      $w = '';
806
      $w = '';
807
    echo '<td valign="top" align="left" '.$w.'>'.@func_get_arg($i+1).'</td>';
807
    echo '<td valign="top" align="left" '.$w.'>'.@func_get_arg($i+1).'</td>';
808
  }
808
  }
809
  if ($j == 0)
809
  if ($j == 0)
810
        echo '<td valign="top" align="left" width="100%">&nbsp;</td>';
810
        echo '<td valign="top" align="left" width="100%">&nbsp;</td>';
811
  echo '</tr>'."\n";
811
  echo '</tr>'."\n";
812
}
812
}
813
 
813
 
814
function gfx_tablespancontent($highlight, $span, $text)
814
function gfx_tablespancontent($highlight, $span, $text)
815
{
815
{
816
  if ($highlight == 1) $hfarb = '4';
816
  if ($highlight == 1) $hfarb = '4';
817
  if ($highlight == 0) $hfarb = '5';
817
  if ($highlight == 0) $hfarb = '5';
818
  if ($highlight == 2) $hfarb = '6';
818
  if ($highlight == 2) $hfarb = '6';
819
  echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">';
819
  echo '<tr class="row_tab" onmouseover="this.className=\'row_tab_act\';" onmouseout="this.className=\'row_tab\';">';
820
  echo '<td valign="top" align="left" colspan="'.$span.'">'.$text.'</td>';
820
  echo '<td valign="top" align="left" colspan="'.$span.'">'.$text.'</td>';
821
  echo '</tr>';
821
  echo '</tr>';
822
 
822
 
823
}
823
}
824
 
824
 
825
function gfx_zeichneitems_filter($modul, $table, $append)
825
function gfx_zeichneitems_filter($modul, $table, $append)
826
{
826
{
827
  global $ordnereinzug, $mysql_zugangsdaten;
827
  global $ordnereinzug, $mysql_zugangsdaten;
828
 
828
 
829
  $einzug = 0;
829
  $einzug = 0;
830
  $ary = liste_items_filter($modul, $table, $append);
830
  $ary = liste_items_filter($modul, $table, $append);
831
  $durchlauf = 0;
831
  $durchlauf = 0;
832
  for ($i=1; isset($ary[$i]['id']); $i++)
832
  for ($i=1; isset($ary[$i]['id']); $i++)
833
  {
833
  {
834
    $durchlauf++;
834
    $durchlauf++;
835
 
835
 
836
    if (file_exists('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php'))
836
    if (file_exists('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php'))
837
      include('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php');
837
      include('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php');
838
 
838
 
839
    echo "\n";
839
    echo "\n";
840
  }
840
  }
841
 
841
 
842
  return $durchlauf;
842
  return $durchlauf;
843
}
843
}
844
 
844
 
845
function gfx_zeichneitems($modul, $table, $append, $folder = 0, $einzug = 0)
845
function gfx_zeichneitems($modul, $table, $append, $folder = 0, $einzug = 0)
846
{
846
{
847
  global $ordnereinzug, $mysql_zugangsdaten;
847
  global $ordnereinzug, $mysql_zugangsdaten;
848
 
848
 
849
  $ary = liste_items($modul, $table, $append, $folder);
849
  $ary = liste_items($modul, $table, $append, $folder);
850
  $durchlauf = 0;
850
  $durchlauf = 0;
851
  for ($i=1; isset($ary[$i]['id']); $i++)
851
  for ($i=1; isset($ary[$i]['id']); $i++)
852
  {
852
  {
853
    $durchlauf++;
853
    $durchlauf++;
854
 
854
 
855
    if (file_exists('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php'))
855
    if (file_exists('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php'))
856
      include('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php');
856
      include('modules/'.wb_dir_escape($modul).'/menueeintrag.inc.php');
857
  }
857
  }
858
 
858
 
859
  return $durchlauf;
859
  return $durchlauf;
860
}
860
}
861
 
861
 
862
function gfx_zeichnemenuepunkt($modul, $seite, $titel, $klein, $gross)
862
function gfx_zeichnemenuepunkt($modul, $seite, $titel, $klein, $gross)
863
{
863
{
864
  if (file_exists($gross))
864
  if (file_exists($gross))
865
    $g = $gross;
865
    $g = $gross;
866
  else
866
  else
867
    $g = 'design/spacer.gif';
867
    $g = 'design/spacer.gif';
868
 
868
 
869
  if (file_exists($klein))
869
  if (file_exists($klein))
870
    $k = $klein;
870
    $k = $klein;
871
  else
871
  else
872
    $k = 'design/spacer.gif';
872
    $k = 'design/spacer.gif';
873
 
873
 
874
  return '<tr class="row_nav" onmouseover="this.className=\'row_nav_act\';" onmouseout="this.className=\'row_nav\';">
874
  return '<tr class="row_nav" onmouseover="this.className=\'row_nav_act\';" onmouseout="this.className=\'row_nav\';">
875
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="design/spacer.gif" height="1" width="3" alt=""></td>
875
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="design/spacer.gif" height="1" width="3" alt=""></td>
876
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="'.$k.'" height="16" width="16" alt=""></td>
876
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="'.$k.'" height="16" width="16" alt=""></td>
877
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="design/spacer.gif" height="1" width="5" alt=""></td>
877
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="bottom" align="left"><img src="design/spacer.gif" height="1" width="5" alt=""></td>
878
  <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>
878
  <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>
879
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="design/spacer.gif" alt="" width="1" height="1"></td>
879
  <td onclick="oop(\''.$modul.'\', \''.$seite.'\', \''.$titel.'\', \''.$g.'\');" valign="middle" align="left"><img src="design/spacer.gif" alt="" width="1" height="1"></td>
880
</tr>'."\n";
880
</tr>'."\n";
881
}
881
}
882
 
882
 
883
function gfx_zeichnemenueplatzhalter()
883
function gfx_zeichnemenueplatzhalter()
884
{
884
{
885
  return '<tr>
885
  return '<tr>
886
  <td colspan="5"><img src="design/spacer.gif" alt="" width="1" height="14"></td>
886
  <td colspan="5"><img src="design/spacer.gif" alt="" width="1" height="14"></td>
887
</tr>';
887
</tr>';
888
}
888
}
889
 
889
 
890
function wb_dir_escape($s) {
890
function wb_dir_escape($s) {
891
        $s = str_replace('..', '__', $s);
891
        $s = str_replace('..', '__', $s);
892
        $s = str_replace('~', '_', $s);
892
        $s = str_replace('~', '_', $s);
893
        $s = str_replace('/', '_', $s);
893
        $s = str_replace('/', '_', $s);
894
        $s = str_replace('\\', '_', $s);
894
        $s = str_replace('\\', '_', $s);
895
        $s = str_replace(chr(0), '_', $s);
895
        $s = str_replace(chr(0), '_', $s);
896
        return $s;
896
        return $s;
897
}
897
}
898
 
898