Changeset 807 for trunk/lib/Utilities.inc.php
- Timestamp:
- Feb 24, 2024 6:31:54 AM (3 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/Utilities.inc.php
r806 r807 25 25 */ 26 26 27 require_once dirname(__FILE__) . '/App.inc.php'; 27 28 28 29 /** … … 186 187 $app =& App::getInstance(); 187 188 189 $indent = trim($indent, ' ') . ' '; 190 188 191 $indent_str = str_repeat($indent, $depth); 189 192 $output = ''; 190 193 if (is_array($var)) { 191 194 foreach ($var as $k=>$v) { 192 $k = ucfirst(mb_strtolower(str_replace( array('_', ' '), ' ', $k)));195 $k = ucfirst(mb_strtolower(str_replace(['_', ' '], ' ', $k))); 193 196 if (is_array($v)) { 194 197 $output .= sprintf("\n%s%s:\n%s\n", $indent_str, $k, fancyDump($v, $indent, $depth+1)); … … 200 203 $output .= sprintf("%s%s\n", $indent_str, $var); 201 204 } 202 return preg_replace(['/^[ \t]+$/' . $app->getParam('preg_u'), '/\n\n+/' . $app->getParam('preg_u'), '/^(?:\S( ))?(?:\S( ))?(?:\S( ))?(?:\S( ))?(?:\S( ))?(?:\S( ))?(?:\S( ))?(?:\S( ))?(\S )/m' . $app->getParam('preg_u')], ['', "\n", '$1$1$2$2$3$3$4$4$5$5$6$6$7$7$8$8$9'], $output); 205 206 return preg_replace([ 207 '/^[ \t]+$/' . $app->getParam('preg_u'), 208 '/\n\n+/' . $app->getParam('preg_u'), 209 sprintf('/^(?:%1$s( ))?(?:%1$s( ))?(?:%1$s( ))?(?:%1$s( ))?(?:%1$s( ))?(?:%1$s( ))?(?:%1$s( ))?(?:%1$s( ))?(%1$s )/m%2$s', preg_quote(trim($indent, ' '), '/'), $app->getParam('preg_u')), 210 ], [ 211 '', 212 "\n", 213 '$1$1$2$2$3$3$4$4$5$5$6$6$7$7$8$8$9' 214 ], $output); 203 215 } 204 216 … … 1516 1528 1517 1529 $addr = canonicalIPAddr(trim($_SERVER['REMOTE_ADDR'])); 1518 return $dolookup && $addr ? gethostbyaddr($addr) : $addr; 1530 if (false !== filter_var($addr, FILTER_VALIDATE_IP, FILTER_FLAG_IPV6 | FILTER_FLAG_IPV4 | FILTER_FLAG_NO_PRIV_RANGE | FILTER_FLAG_NO_RES_RANGE)) { 1531 return $dolookup && '' != $addr ? gethostbyaddr($addr) : $addr; 1532 } 1533 1534 return ''; 1519 1535 } 1520 1536
Note: See TracChangeset
for help on using the changeset viewer.