Rev 12 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | daniel-mar | 1 | <?php |
2 | |||
9 | daniel-mar | 3 | $xxx_vts_prepend_config = array(); |
10 | daniel-mar | 4 | if (file_exists($xxx_vts_prepend_config_file = __DIR__.'/../config.local.php')) include $xxx_vts_prepend_config_file; |
9 | daniel-mar | 5 | unset($xxx_vts_prepend_config_file); |
12 | daniel-mar | 6 | $xxx_directories_need_ereg = $xxx_vts_prepend_config['directories_need_ereg'] ?? array(); /* @phpstan-ignore-line */ |
9 | daniel-mar | 7 | unset($xxx_vts_prepend_config); |
2 | daniel-mar | 8 | |
9 | $xxx_go = false; |
||
12 | daniel-mar | 10 | foreach ($xxx_directories_need_ereg as $xxx_directory_need_ereg) { /* @phpstan-ignore-line */ |
9 | daniel-mar | 11 | if ($xxx_negate = (substr($xxx_directory_need_ereg,0,1) === '!')) { |
12 | $xxx_directory_need_ereg = substr($xxx_directory_need_ereg,1); |
||
13 | } |
||
2 | daniel-mar | 14 | if (strpos($_SERVER['SCRIPT_FILENAME'], $xxx_directory_need_ereg) === 0) { |
9 | daniel-mar | 15 | $xxx_go = !$xxx_negate; |
2 | daniel-mar | 16 | } |
13 | daniel-mar | 17 | if (strpos($_SERVER['PWD'] ?? '', $xxx_directory_need_ereg) === 0) { |
18 | $xxx_go = !$xxx_negate; |
||
19 | } |
||
9 | daniel-mar | 20 | unset($xxx_negate); |
2 | daniel-mar | 21 | } |
22 | unset($xxx_directories_need_ereg); |
||
23 | unset($xxx_directory_need_ereg); |
||
9 | daniel-mar | 24 | |
12 | daniel-mar | 25 | if ($xxx_go) { /* @phpstan-ignore-line */ |
2 | daniel-mar | 26 | if (function_exists('ereg') !== true) { |
27 | function ereg($pattern, $string, &$regs) { |
||
28 | return preg_match('~' . addcslashes($pattern, '~') . '~', $string, $regs); |
||
29 | } |
||
30 | } |
||
31 | |||
32 | if (function_exists('eregi') !== true) { |
||
33 | function eregi($pattern, $string, &$regs) { |
||
34 | return preg_match('~' . addcslashes($pattern, '~') . '~i', $string, $regs); |
||
35 | } |
||
36 | } |
||
37 | |||
38 | if (function_exists('ereg_replace') !== true) { |
||
39 | function ereg_replace($pattern, $string, $replace) { |
||
40 | return preg_replace('~' . addcslashes($pattern, '~') . '~', $string, $replace); |
||
41 | } |
||
42 | } |
||
43 | |||
44 | if (function_exists('eregi_replace') !== true) { |
||
45 | function eregi_replace($pattern, $string, $replace) { |
||
46 | return preg_replace('~' . addcslashes($pattern, '~') . '~i', $string, $replace); |
||
47 | } |
||
48 | } |
||
49 | |||
50 | if (function_exists('split') !== true) { |
||
51 | function split($pattern, $string, $limit=-1) { |
||
52 | return preg_split('~' . addcslashes($pattern, '~') . '~', $string, $limit); |
||
53 | } |
||
54 | } |
||
55 | |||
56 | if (function_exists('spliti') !== true) { |
||
57 | function spliti($pattern, $string, $limit=-1) { |
||
58 | return preg_split('~' . addcslashes($pattern, '~') . '~i', $string, $limit); |
||
59 | } |
||
60 | } |
||
61 | |||
62 | if (function_exists('sql_regcase') !== true) { |
||
63 | function sql_regcase($string) { |
||
64 | $out = ''; |
||
65 | for ($i=0; $i<strlen($string); $i++) { |
||
66 | $char = $string[$i]; |
||
67 | $up = strtoupper($char); |
||
68 | $low = strtolower($char); |
||
69 | if ($up != $low) { |
||
7 | daniel-mar | 70 | $out .= "[$up$low]"; |
2 | daniel-mar | 71 | } else { |
72 | $out .= $char; |
||
73 | } |
||
74 | } |
||
75 | return $out; |
||
76 | } |
||
77 | } |
||
78 | } |
||
79 | unset($xxx_go); |