From 28218071669bf2b757c747e32b54f855068a4109 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 22 Mar 2010 19:37:03 +0000 Subject: cleanup, bugfix --- it.class | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index ab4d87b..b1ed522 100644 --- a/it.class +++ b/it.class @@ -746,19 +746,21 @@ static function mail($p) */ static function file_get($filename, $p = array()) { - $data = file_get_contents($filename == "-" ? "php://stdin" : $filename); - if ($p['keyval'] && $data !== false) + if (($data = file_get_contents($filename == "-" ? "php://stdin" : $filename)) !== false) { - foreach (explode("\n", rtrim($data, "\n")) as $line) + if ($p['keyval']) { - $arr = explode("\t", $line, 2); - $result[$arr[0]] = $arr[1]; + foreach (explode("\n", rtrim($data, "\n")) as $line) + { + $arr = explode("\t", $line, 2); + $result[$arr[0]] = $arr[1]; + } } + else if ($p['lines']) + $result = explode("\n", rtrim($data, "\n")); + else + $result = $data; } - else if ($p['lines']) - $result = $data !== false ? explode("\n", rtrim($data, "\n")) : array(); - else - $result = $data; return $result; } -- cgit v1.2.3