X-Git-Url: https://git.ao2.it/tweeper.git/blobdiff_plain/4c4771f61019b68bdf3d6896995fe9fb24b5fd45..69e71256e0c4a30c57fe13f0ff5b3038e2c5f563:/tweeper.php?ds=sidebyside diff --git a/tweeper.php b/tweeper.php index 37b73f5..178176d 100644 --- a/tweeper.php +++ b/tweeper.php @@ -32,12 +32,20 @@ class Tweeper { public static function epoch_to_gmdate($timestamp) { + if (!is_numeric($timestamp) || is_nan($timestamp)) { + $timestamp = 0; + } + return gmdate('D, d M Y H:i:s', $timestamp) . ' GMT'; } public static function str_to_gmdate($date) { $timestamp = strtotime($date); + if (FALSE === $timestamp) { + $timestamp = 0; + } + return Tweeper::epoch_to_gmdate($timestamp); } @@ -153,7 +161,7 @@ class Tweeper { private function load_stylesheet($host) { $stylesheet = "file://" . __DIR__ . "/rss_converter_" . $host . ".xsl"; if (FALSE === file_exists($stylesheet)) { - trigger_error("Conversion to RSS not supported: $host", E_USER_ERROR); + trigger_error("Conversion to RSS not supported for $host ($stylesheet not found)", E_USER_ERROR); return NULL; }