Rev 143 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 143 | Rev 149 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | 2 | ||
3 | # |
3 | # |
4 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
4 | # VGWhoIs (ViaThinkSoft Global WhoIs, a fork of generic Whois / gwhois) |
5 | # Common functions in PHP |
5 | # Common functions in PHP |
6 | # |
6 | # |
7 | # (c) 2011-2013 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
7 | # (c) 2011-2024 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
8 | # |
8 | # |
9 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
9 | # License: https://www.gnu.org/licenses/gpl-2.0.html (GPL version 2) |
10 | # |
10 | # |
11 | 11 | ||
12 | include_once __DIR__ . '/ipv4_functions.inc.php'; |
12 | include_once __DIR__ . '/ipv4_functions.inc.php'; |
Line 134... | Line 134... | ||
134 | 134 | ||
135 | return implode("\n", $out); |
135 | return implode("\n", $out); |
136 | } |
136 | } |
137 | 137 | ||
138 | function make_tabs($text, $abstand = 4) { |
138 | function make_tabs($text, $abstand = 4) { |
- | 139 | $encoding = @ini_get('default_charset'); |
|
- | 140 | if ($encoding === false) $encoding = null; |
|
139 | $ary = explode("\n", $text); |
141 | $ary = explode("\n", $text); |
140 | $longest = 0; |
142 | $longest = 0; |
141 | foreach ($ary as $a) { |
143 | foreach ($ary as $a) { |
142 | $bry = explode(':', $a, 2); |
144 | $bry = explode(':', $a, 2); |
143 | if (count($bry) < 2) continue; |
145 | if (count($bry) < 2) continue; |
144 | $c = strlen($bry[0]); |
146 | $c = !is_null($encoding) ? mb_strlen($bry[0], $encoding) : strlen($bry[0]); |
145 | if ($c > $longest) $longest = $c; |
147 | if ($c > $longest) $longest = $c; |
146 | } |
148 | } |
147 | foreach ($ary as $n => $a) { |
149 | foreach ($ary as $n => $a) { |
148 | $bry = explode(':', $a, 2); |
150 | $bry = explode(':', $a, 2); |
149 | if (count($bry) < 2) continue; |
151 | if (count($bry) < 2) continue; |
- | 152 | $c_ = !is_null($encoding) ? mb_strlen($bry[0], $encoding) : strlen($bry[0]); |
|
150 | $rep = $longest-strlen($bry[0]) + $abstand; |
153 | $rep = $longest - $c_ + $abstand; |
151 | if ($rep < 1) { |
154 | if ($rep < 1) { |
152 | $wh = ''; |
155 | $wh = ''; |
153 | } else { |
156 | } else { |
154 | $wh = str_repeat(' ', $rep); |
157 | $wh = str_repeat(' ', $rep); |
155 | } |
158 | } |
Line 157... | Line 160... | ||
157 | } |
160 | } |
158 | $x = implode("\n", $ary); |
161 | $x = implode("\n", $ary); |
159 | return $x; |
162 | return $x; |
160 | } |
163 | } |
161 | 164 | ||
162 | function uc_latin1($str) { |
- | |
163 | # Source: http://de3.php.net/manual/en/function.strtoupper.php#82592 |
- | |
164 | $str = strtoupper(strtr($str, "àáâãäåæçèéêëìíîïðñòóôõöøùúûüý", |
- | |
165 | "ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝ")); |
- | |
166 | return strtr($str, array("ß" => "SS")); |
- | |
167 | } |
- | |
168 | - | ||
169 | /** |
165 | /** |
170 | * Converts tabs to the appropriate amount of spaces while preserving formatting |
166 | * Converts tabs to the appropriate amount of spaces while preserving formatting |
171 | * |
167 | * |
172 | * @author Aidan Lister <aidan@php.net> |
168 | * @author Aidan Lister <aidan@php.net> |
173 | * @version 1.2.0 |
169 | * @version 1.2.0 |