]> git.wh0rd.org - tt-rss.git/blobdiff - include/functions.php
smart_date_time: add special case when article date is within current hour
[tt-rss.git] / include / functions.php
index 9b93aed80b3235e2c7c4e54546552e8824fa52fb..84c1e35ff5f3ee3b271051321a51e5da0ef43a27 100644 (file)
@@ -67,6 +67,7 @@
                $tr = array(
                                        "auto"  => "Detect automatically",
                                        "ar_SA" => "العربيّة (Arabic)",
+                                       "bg_BG" => "Bulgarian",
                                        "da_DA" => "Dansk",
                                        "ca_CA" => "Català",
                                        "cs_CZ" => "Česky",
@@ -98,8 +99,6 @@
        require_once "lib/accept-to-gettext.php";
        require_once "lib/gettext/gettext.inc";
 
-       require_once "lib/languagedetect/LanguageDetect.php";
-
        function startup_gettext() {
 
                # Get locale from Accept-Language header
 
        function initialize_user($uid) {
 
-               db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
-                       values ('$uid', 'Tiny Tiny RSS: New Releases',
-                       'http://tt-rss.org/releases.rss')");
-
                db_query("insert into ttrss_feeds (owner_uid,title,feed_url)
                        values ('$uid', 'Tiny Tiny RSS: Forum',
                                'http://tt-rss.org/forum/rss.php')");
        function smart_date_time($timestamp, $tz_offset = 0, $owner_uid = false) {
                if (!$owner_uid) $owner_uid = $_SESSION['uid'];
 
-               if (date("Y.m.d", $timestamp) == date("Y.m.d", time() + $tz_offset)) {
+               if (date("Y.m.d.G", $timestamp) == date("Y.m.d.G", time() + $tz_offset)) {
+                       return T_sprintf("%d min", date("i", time() + $tz_offset - $timestamp));
+               } else if (date("Y.m.d", $timestamp) == date("Y.m.d", time() + $tz_offset)) {
                        return date("G:i", $timestamp);
                } else if (date("Y", $timestamp) == date("Y", time() + $tz_offset)) {
                        $format = get_pref('SHORT_DATE_FORMAT', $owner_uid);
                        $feed_id = db_fetch_result($result, 0, "id");
 
                        if ($feed_id) {
-                               update_rss_feed($feed_id, true);
+                               set_basic_feed_info($feed_id);
                        }
 
                        return array("code" => 1);