Beispiel #1
0
function fof_db_get_subscribed_users_count($feed_id)
{
    fof_trace();
    $sub_statement = fof_db_get_subscribed_users($feed_id);
    $subscribed_users = $sub_statement->fetchAll();
    return count($subscribed_users);
}
Beispiel #2
0
function fof_get_subscribed_users($feed_id)
{
    return fof_db_get_subscribed_users($feed_id);
}
if (!empty($messages)) {
    echo '<div class="notice">';
    foreach ($messages as $msg) {
        echo '<div>' . $msg . '</div>' . "\n";
    }
    echo '</div>' . "\n";
    /* sidebar will be wrong until refreshed */
    echo '<script>document.observe("dom:loaded", function() { refreshlist(); });</script>';
}
/* let admin see any feed */
if (fof_is_admin()) {
    echo '<h1>Admin Feed Details</h1>' . "\n";
    echo '<div class="subscribers">' . "\n";
    echo '<h2>Subscribers</h2>' . "\n";
    echo '<ul>' . "\n";
    $sub_statement = fof_db_get_subscribed_users($feed_id);
    $users = fof_db_get_users();
    while (($subscriber = fof_db_get_row($sub_statement, 'user_id')) !== false) {
        echo '<li>' . $users[$subscriber]['user_name'] . ' (' . $subscriber . ')</li>' . "\n";
    }
    echo '</ul>' . "\n";
    echo '</div>' . "\n";
} elseif (fof_db_is_subscribed_id(fof_current_user(), $feed_id)) {
    echo '<h1>Feed Details</h1>' . "\n";
} else {
    echo '<div class="error"><h1>Not Subscribed</h1>You don\'t know anything about that feed.</div>' . "\n";
    die;
}
if (fof_is_admin() && !fof_db_is_subscribed_id(fof_current_user(), $feed_id)) {
    /* fof_get_feed expects a subscription, so shirk that and just populate overall stats */
    $feed_row = fof_db_get_feed_by_id($feed_id);
Beispiel #4
0
function fof_apply_plugin_tags($feed_id, $item_id = NULL, $user_id = NULL)
{
    $users = array();
    if ($user_id) {
        $users[] = $user_id;
    } else {
        $result = fof_db_get_subscribed_users($feed_id);
        while (($row = fof_db_get_row($result)) !== false) {
            $users[] = $row['user_id'];
        }
    }
    $items = array();
    if ($item_id) {
        $items[] = fof_db_get_item($user_id, $item_id);
    } else {
        $result = fof_db_get_items($user_id, $feed_id, $what = "all", NULL, NULL);
        foreach ($result as $r) {
            $items[] = $r;
        }
    }
    $userdata = fof_db_get_users();
    foreach ($users as $user) {
        fof_log("tagging for {$user}");
        global $fof_tag_prefilters;
        foreach ($fof_tag_prefilters as $plugin => $filter) {
            fof_log("considering {$plugin} {$filter}");
            foreach ($items as $item) {
                $tags = $filter($item['item_link'], $item['item_title'], $item['item_content'], $item);
                fof_tag_item($user, $item['item_id'], $tags);
            }
        }
    }
}