Exemplo n.º 1
0
    }
    echo "</nobr></a></td>";
}
?>

<td></td>
</tr>

<?php 
foreach ($feeds as $row) {
    $id = $row['id'];
    $url = htmlspecialchars($row['url']);
    $title = htmlspecialchars($row['title']);
    $link = htmlspecialchars($row['link']);
    $description = $row['description'];
    $age = fof_rss_age($row['url']);
    $unread = $row['unread'];
    $items = $row['items'];
    $agestr = $row['agestr'];
    $agestrabbr = $row['agestrabbr'];
    if (++$t % 2) {
        print "<tr class=\"odd-row\">";
    } else {
        print "<tr>";
    }
    $u = "view.php?feed={$id}";
    $u2 = "view.php?feed={$id}&amp;what=all&amp;how=paged";
    print "<td><span title=\"{$agestr}\">{$agestrabbr}</span></td>";
    print "<td class=\"nowrap\">";
    if ($unread) {
        print "<a class=\"unread\" title=\"new items\" href=\"{$u}\">{$unread}</a>/";
Exemplo n.º 2
0
function fof_get_feeds()
{
    global $FOF_FEED_TABLE, $FOF_ITEM_TABLE;
    $result = fof_do_query("select id, url, title, link, description from {$FOF_FEED_TABLE} order by title");
    $i = 0;
    while ($row = mysql_fetch_array($result)) {
        $id = $row['id'];
        $age = fof_rss_age($row['url']);
        $feeds[$i]['id'] = $id;
        $feeds[$i]['url'] = $row['url'];
        $feeds[$i]['title'] = $row['title'];
        $feeds[$i]['link'] = $row['link'];
        $feeds[$i]['description'] = $row['description'];
        $feeds[$i]['age'] = $age;
        if ($age == -1) {
            $agestr = "never";
            $agestrabbr = "&infin;";
        } else {
            $seconds = $age % 60;
            $minutes = $age / 60 % 60;
            $hours = $age / 60 / 60 % 24;
            $days = floor($age / 60 / 60 / 24);
            if ($seconds) {
                $agestr = "{$seconds} second";
                if ($seconds != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $seconds . "s";
            }
            if ($minutes) {
                $agestr = "{$minutes} minute";
                if ($minutes != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $minutes . "m";
            }
            if ($hours) {
                $agestr = "{$hours} hour";
                if ($hours != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $hours . "h";
            }
            if ($days) {
                $agestr = "{$days} day";
                if ($days != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $days . "d";
            }
        }
        $feeds[$i]['agestr'] = $agestr;
        $feeds[$i]['agestrabbr'] = $agestrabbr;
        $i++;
    }
    $result = fof_do_query("select count( feed_id ) as count, feed_id as id from {$FOF_FEED_TABLE}, {$FOF_ITEM_TABLE} where {$FOF_FEED_TABLE}.id = {$FOF_ITEM_TABLE}.feed_id and `read` is null group by feed_id order by {$FOF_FEED_TABLE}.title");
    while ($row = mysql_fetch_array($result)) {
        for ($i = 0; $i < count($feeds); $i++) {
            if ($feeds[$i]['id'] == $row['id']) {
                $feeds[$i]['unread'] = $row['count'];
            }
        }
    }
    $result = fof_do_query("select count( feed_id ) as count, feed_id as id from {$FOF_FEED_TABLE}, {$FOF_ITEM_TABLE} where {$FOF_FEED_TABLE}.id = {$FOF_ITEM_TABLE}.feed_id group by feed_id order by {$FOF_FEED_TABLE}.title");
    while ($row = mysql_fetch_array($result)) {
        for ($i = 0; $i < count($feeds); $i++) {
            if ($feeds[$i]['id'] == $row['id']) {
                $feeds[$i]['items'] = $row['count'];
            }
        }
    }
    return $feeds;
}
Exemplo n.º 3
0
function fof_get_feeds($order = 'title', $direction = 'asc', $tags = '')
{
    fof_prune_expir_feeds();
    $sql = "select id, url, title, link, image, description from feeds";
    if ($tags != '' && $tags != _("All tags") && $tags != _("No tags")) {
        $sql .= " where tags LIKE '%{$tags}%'";
    }
    if ($tags == _("No tags")) {
        $sql .= " where tags IS NULL or tags LIKE ''";
    }
    $sql .= " order by title";
    $result = fof_do_query($sql);
    $i = 0;
    while ($row = mysql_fetch_array($result)) {
        #$id = $row['id'];
        $feeds[$i]['id'] = $row['id'];
        $feeds[$i]['url'] = $row['url'];
        $feeds[$i]['title'] = $row['title'];
        $feeds[$i]['link'] = $row['link'];
        $feeds[$i]['description'] = $row['description'];
        $feeds[$i]['image'] = $row['image'];
        $age = fof_rss_age($feeds[$i]['url']);
        $feeds[$i]['age'] = $age;
        if ($age == FOF_MAX_INT) {
            $agestr = "never";
            $agestrabbr = "&infin;";
        } else {
            $seconds = $age % 60;
            $minutes = $age / 60 % 60;
            $hours = $age / 60 / 60 % 24;
            $days = floor($age / 60 / 60 / 24);
            if ($seconds) {
                $agestr = "{$seconds} sec";
                if ($seconds != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $seconds . "s";
            }
            if ($minutes) {
                $agestr = "{$minutes} min";
                if ($minutes != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $minutes . "m";
            }
            if ($hours) {
                $agestr = "{$hours} hr";
                if ($hours != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $hours . "h";
            }
            if ($days) {
                $agestr = "{$days} day";
                if ($days != 1) {
                    $agestr .= "s";
                }
                $agestr .= " ago";
                $agestrabbr = $days . "d";
            }
        }
        $feeds[$i]['agestr'] = $agestr;
        $feeds[$i]['agestrabbr'] = $agestrabbr;
        $i++;
    }
    $result = fof_do_query("select count( feed_id ) as count, feed_id as id from feeds, items where feeds.id = items.feed_id and `read` is null group by feed_id order by feeds.title");
    while ($row = mysql_fetch_array($result)) {
        for ($i = 0; $i < count($feeds); $i++) {
            if ($feeds[$i]['id'] == $row['id']) {
                $feeds[$i]['unread'] = $row['count'];
            }
        }
    }
    $result = fof_do_query("select count( feed_id ) as count, feed_id as id from feeds, items where feeds.id = items.feed_id group by feed_id order by feeds.title");
    while ($row = mysql_fetch_array($result)) {
        for ($i = 0; $i < count($feeds); $i++) {
            if ($feeds[$i]['id'] == $row['id']) {
                $feeds[$i]['items'] = $row['count'];
            }
        }
    }
    $feeds = fof_multi_sort($feeds, $order, $direction != "asc");
    return $feeds;
}