diff options
author | Urban Müller | 2023-08-31 14:09:37 +0200 |
---|---|---|
committer | Urban Müller | 2023-08-31 14:09:37 +0200 |
commit | 6a67ff9f5d045a5fdde2db887605850741b1cffa (patch) | |
tree | 559c4a6bc40be415ca74d3c7790f3833d8f35ff5 /it.class | |
parent | faf1e994daa144fbc3dcaea30c2647266a752636 (diff) | |
download | itools-6a67ff9f5d045a5fdde2db887605850741b1cffa.tar.gz itools-6a67ff9f5d045a5fdde2db887605850741b1cffa.tar.bz2 itools-6a67ff9f5d045a5fdde2db887605850741b1cffa.zip |
allow https in error mails
Diffstat (limited to 'it.class')
-rw-r--r-- | it.class | 9 |
1 files changed, 6 insertions, 3 deletions
@@ -186,7 +186,7 @@ static function error($p = array(), $extra = null) return null; # prevent recursion if ($_SERVER['REMOTE_ADDR']) - $url = "http://" . it::replace([':443$' => ""], $_SERVER['HTTP_HOST']) . $_SERVER['REQUEST_URI']; # we ignore https for easier debugging + $url = ($_SERVER['HTTPS'] ? "https://" : "http://") . $_SERVER['REQUEST_URI']; else $url = $_SERVER['SCRIPT_NAME'] . " " . implode(" ", array_slice($GLOBALS['argv'], 1)) . " (pwd " . $_SERVER['PWD'] . ")"; @@ -1158,10 +1158,13 @@ static function mail($p) * @param $p['keyval'] each line of the file is one tab-separated key/value pair, return assoc array * @param $p['lines'] return file as array of lines without newline * @param $p['json'] return data json-decoded, set to "assoc" to get objects as assoc arrays + * @param $p['it_cache'] cache with these parameters */ static function file_get($filename, $p = array()) { - if (($data = it::file_get_contents($filename == "-" ? "php://stdin" : $filename)) !== false) + if (isset($p['it_cache']) && ($key = "it_file_get_" . md5(json_encode([$filename, $p]))) && ($result = it_cache::get($key, $p['it_cache'])) !== null) + return $result; + elseif (($data = it::file_get_contents($filename == "-" ? "php://stdin" : $filename)) !== false) { if ($p['keyval']) { @@ -1179,7 +1182,7 @@ static function file_get($filename, $p = array()) $result = $data; } - return $result; + return isset($p['it_cache']) ? it_cache::put($key, $result, $p['it_cache']) : $result; } /** |