Rev 76 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 76 | Rev 148 | ||
---|---|---|---|
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) 2013-2019 by Daniel Marschall, ViaThinkSoft <info@daniel-marschall.de> |
7 | # (c) 2013-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 | function getpatternfiles() { |
12 | function getpatternfiles() { |
Line 44... | Line 44... | ||
44 | 44 | ||
45 | $cachefile = $cache_dir . '/' . sha1($url) . '.cache'; |
45 | $cachefile = $cache_dir . '/' . sha1($url) . '.cache'; |
46 | if (!is_dir($cache_dir)) mkdir($cache_dir, 0755, true); |
46 | if (!is_dir($cache_dir)) mkdir($cache_dir, 0755, true); |
47 | if (file_age($cachefile) > $max_age) { |
47 | if (file_age($cachefile) > $max_age) { |
48 | $cont = file_get_contents($url, false, $context); |
48 | $cont = file_get_contents($url, false, $context); |
49 | file_put_contents($cachefile, $cont); |
49 | if ($cont !== false) file_put_contents($cachefile, $cont); |
50 | } else { |
50 | } else { |
51 | $cont = file_get_contents($cachefile); |
51 | $cont = file_get_contents($cachefile); |
52 | } |
52 | } |
53 | 53 | ||
54 | if ($cont === false) { |
54 | if ($cont === false) { |