示例#1
0
    $title = htmlentities($row['display_title'], ENT_QUOTES);
    $alt_image = htmlentities($row['alt_image'], ENT_QUOTES);
    $description = $row['feed_description'];
    $tags = $row['tags'];
    echo '<tr' . (++$t % 2 ? ' class="odd-row"' : '') . ">\n";
    if ($prefs->get('favicons')) {
        $feed_image = $row['display_image'];
    }
    if (empty($feed_image)) {
        $feed_image = 'image/feed-icon.png';
    }
    echo "  <td><a href=\"{$url}\" title=\"feed\" name=\"{$anchor}\"><img src='{$feed_image}' width='16' height='16' border='0' /></a></td>";
    echo "  <td>\n    <form method=\"post\" action=\"prefs.php#{$anchor}\">\n      <input type=\"hidden\" name=\"changed\" value=\"{$id}\"/>\n      <input type=\"text\" name=\"title\" value=\"{$title}\" size=\"50\"/>\n      <input type=\"text\" name=\"alt_image\" value=\"{$alt_image}\" size=\"50\"/>\n      <input type=\"submit\" value=\"submit\"/>\n    </form>\n  </td>";
    echo "  <td align=right>";
    foreach ($tags as $tag) {
        echo $tag . ' <a href="' . fof_url('prefs.php', array('untagfeed' => $id, 'tag' => $tag), $anchor) . '">[x]</a> ';
    }
    echo "</td>\n";
    $title = htmlspecialchars($title);
    echo "  <td>\n    <form method=\"post\" action=\"prefs.php#{$anchor}\">\n      <input type=\"hidden\" name=\"feed_id\" value=\"{$id}\">\n      <input type=\"text\" name=\"tag\">\n      <input type=\"submit\" name=\"tagfeed\" value=\"Tag Feed\"> <small><i>(separate tags with spaces)</i></small>\n    </form>\n  </td>\n";
    echo "</tr>\n";
}
?>
</table>
</div>


<?php 
if (fof_is_admin()) {
    ?>
示例#2
0
    $which = $sharing == "all" || $sharing == "all_tagged" ? $_GET['which'] : "shared " . $_GET['which'];
    $extratitle = " items tagged " . $_GET['which'];
} else {
    $extratitle = '';
}
$feed = NULL;
if (isset($_GET['feed'])) {
    $feed = $_GET['feed'];
    $r = fof_db_get_feed_by_id($feed);
    $extratitle .= " from <a href='" . $r['feed_link'] . "'>" . $r['feed_title'] . "</a>";
}
$result = fof_get_items($user, $feed, $which, NULL, 0, 100);
$qv = array('user' => $user, 'which' => isset($_GET['which']) ? $_GET['which'] : NULL, 'feed' => isset($_GET['feed']) ? $_GET['feed'] : NULL);
$baseurl = 'http' . (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 's' : '') . '://' . $_SERVER['SERVER_NAME'] . $_SERVER['PHP_SELF'];
$shared_feed = fof_url($baseurl, array_merge($qv, array('format' => 'atom')));
$shared_link = fof_url($baseurl, $qv);
if ($format == 'atom') {
    fof_set_content_type('application/atom+xml');
    echo '<?xml version="1.0"?>';
    ?>

<feed xmlns="http://www.w3.org/2005/Atom">
    <title>Feed on Feeds - Shared Items<?php 
    if ($name) {
        echo " from {$name}";
    }
    if ($extratitle) {
        echo " " . strip_tags($extratitle);
    }
    ?>
</title>
示例#3
0
function fof_sidebar_tags_default()
{
    global $sharing;
    global $what_a;
    $unread_id = fof_db_get_tag_by_name('unread');
    $star_id = fof_db_get_tag_by_name('star');
    $folded_id = fof_db_get_tag_by_name('folded');
    $tags = fof_get_tags(fof_current_user());
    $taglines = array();
    $n = 0;
    foreach ($tags as $tag) {
        $tag_id = $tag['tag_id'];
        if ($tag_id == $unread_id || $tag_id == $star_id || $tag_id == $folded_id) {
            continue;
        }
        $tagline = '';
        $tag_name = $tag['tag_name'];
        $tag_name_html = htmlentities($tag_name);
        $tag_name_json = htmlentities(json_encode($tag_name), ENT_QUOTES);
        $count = $tag['count'];
        $unread = $tag['unread'];
        $tag_classes = array();
        if (++$n % 2) {
            $tag_classes[] = 'odd-row';
        }
        if (in_array($tag_name, $what_a)) {
            $tag_classes[] = 'current-view';
        }
        $tag_classes = implode(' ', $tag_classes);
        if (!empty($tag_classes)) {
            $tag_classes = ' class="' . $tag_classes . '"';
        }
        $tagline .= '    <tr' . $tag_classes . '>';
        $tagline .= '<td class="unread">';
        if ($unread) {
            $tagline .= '<a class="unread" href="' . fof_url('.', array('what' => "{$tag_name} unread", 'how' => 'paged')) . "\">{$unread}</a>/";
        }
        $tagline .= '<a href="' . fof_url('.', array('what' => $tag_name, 'how' => 'paged')) . "\">{$count}</a>";
        $tagline .= '</td>';
        $tagline .= '<td class="title"><b><a href="' . fof_url('.', array('what' => $tag_name, 'how' => 'paged')) . '">' . $tag_name_html . '</a></b></td>';
        $tagline .= '<td class="controls"><a href="#" title="untag all items" onclick="return sb_del_tag_conf(' . $tag_name_json . ');">[x]</a></td>';
        if ($sharing == 'all_tagged') {
            $tagline .= '<td class="sharing"><a href="' . fof_url('./shared.php', array('user' => $fof_user_id, 'which' => $tag_name, 'how' => 'paged')) . '">[' . $tag_name_html . ']</a>';
        }
        $tagline .= '</tr>';
        $taglines[] = $tagline;
    }
    if (!empty($taglines)) {
        ?>
    <div id="tags">
      <table cellspacing="0" cellpadding="1" border="0" id="taglist">
        <tr class="heading"><td><span class="unread">#</span></td><td class="title">tag name</td><td class="controls">untag</td><?php 
        if ($sharing == 'all_tagged') {
            echo '<td class="sharing">shared page</td>';
        }
        ?>
</tr>
    <?php 
        echo implode("\n", $taglines);
        ?>
      </table>
    </div>
    <!--tags end-->
    <?php 
    }
    ?>

<?php 
}
示例#4
0
function fof_render_item($item, $include_div = true)
{
    global $fof_asset;
    global $fof_render_filters;
    $feed_link = fof_render_get_key_($item, 'feed_link');
    if ($feed_link == "[no link]") {
        $feed_link = $item['feed_url'];
    }
    $feed_title = fof_render_get_key_($item, 'display_title');
    if ($feed_title == "[no title]") {
        $feed_title = $feed_link;
    }
    $feed_image = fof_render_get_key_($item, 'display_image', $fof_asset['feed_icon']);
    $feed_description = fof_render_get_key_($item, 'feed_description');
    $item_link = fof_render_get_key_($item, 'item_link');
    $item_id = fof_render_get_key_($item, 'item_id');
    $item_title = fof_render_get_key_($item, 'item_title', '[no title]');
    $item_author = fof_render_get_key_($item, 'item_author', '');
    $item_content = fof_render_get_key_($item, 'item_content');
    $item_read = fof_render_get_key_($item, 'item_read');
    foreach ($fof_render_filters as $filter) {
        $item_content = $filter($item_content);
    }
    $prefs = fof_prefs();
    $offset = fof_render_get_key_($prefs, 'tzoffset') * 60 * 60;
    $item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset);
    $item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset);
    $item_updated = gmdate("Y-n-d g:ia", $item['item_updated'] + $offset);
    if (!empty($_GET['search'])) {
        $item_content = do_highlight("<span>{$item_content}</span>", $_GET['search'], "highlight");
        $item_title = do_highlight("<span>{$item_title}</span>", $_GET['search'], "highlight");
    }
    $tags = fof_render_get_key_($item, 'tags', array());
    $star = in_array("star", $tags) ? true : false;
    $star_image = $star ? $fof_asset['star_on_image'] : $fof_asset['star_off_image'];
    $unread = in_array("unread", $tags) ? true : false;
    $folded = in_array('folded', $tags) ? true : false;
    if ($include_div) {
        echo '<div class="item ' . ($folded ? 'hidden' : 'shown') . '" id="i' . $item_id . '" onclick="return itemClicked(event)">' . "\n";
    }
    ?>

<div class="header">
	<span class="controls">
		<a class="uparrow" href="#" onclick="hide_body('<?php 
    echo $item_id;
    ?>
');return false;">fold &uarr;</a>
		<a class="downarrow" href="#" onclick="show_body('<?php 
    echo $item_id;
    ?>
');return false;">unfold &darr;</a>
		<a href="#" onclick="ajax_mark_read('<?php 
    echo $item_id;
    ?>
'); return false;">mark read</a>
	</span>
	<h1 <?php 
    if ($unread) {
        echo "class='unread-item'";
    }
    ?>
>
		<input type="checkbox"
			   name="c<?php 
    echo $item_id;
    ?>
"
			   id="c<?php 
    echo $item_id;
    ?>
"
			   value="checked"
			   ondblclick="flag_upto('c<?php 
    echo $item_id;
    ?>
');"
			   onclick="return checkbox(event);"
			   title="shift-click or double-click to flag all items up to this one" />
<?php 
    echo '		<img id="fav' . $item_id . '" class="' . ($star ? '' : 'un') . 'starred" src="' . $star_image . '" onclick="return toggle_favorite(' . $item_id . ')" />' . "\n";
    ?>
		<script>
			document.getElementById('fav<?php 
    echo $item_id;
    ?>
').star = <?php 
    if ($star) {
        echo 'true';
    } else {
        echo 'false';
    }
    ?>
;
		</script>
<?php 
    echo "\t\t<a href=\"{$item_link}\"" . (fof_render_get_key_($prefs, 'item_target') ? ' target="_blank"' : '') . ">{$item_title}</a>\n";
    if ($item_author) {
        echo '<span class="author">' . htmlentities($item_author) . '</span>';
    }
    ?>
	</h1>

	<span class="tags">
<?php 
    /* show non-system tags */
    foreach (array_diff($tags, array('unread', 'star', 'folded')) as $tag) {
        echo '		<a href="' . fof_url('.', array('what' => $tag)) . '">' . htmlentities($tag) . '</a>';
        echo '		<a href="#" class="untag" title="remove ' . htmlentities('"' . $tag . '"') . ' tag" onclick="return remove_tag(' . $item_id . ',' . htmlentities(json_encode($tag), ENT_QUOTES) . ');">[x]</a>' . "\n";
    }
    ?>
		<a href="#" onclick="return itemTagAddShow('<?php 
    echo $item_id;
    ?>
', this);">add tag</a>
		<div id="addtag<?php 
    echo $item_id;
    ?>
" style="display: none !important">
			<input onfocus="this.value=''" onkeypress="itemTagAdd('<?php 
    echo $item_id;
    ?>
', event.keyCode);" type="text" id="tag<?php 
    echo $item_id;
    ?>
" size="12" value="enter tag here" />
			<input type="button" name="add tag" value="tag" onclick="itemTagAdd('<?php 
    echo $item_id;
    ?>
');" />
		</div>
	</span>

	<span class="dash"> - </span>

	<h2>
<?php 
    if ($feed_image && $prefs['favicons']) {
        echo '		<img class="feed-icon" src="' . $feed_image . '" />' . "\n";
    }
    ?>
		<a href="<?php 
    echo $feed_link;
    ?>
" title="<?php 
    echo htmlspecialchars($feed_description);
    ?>
"><?php 
    echo $feed_title;
    ?>
</a>
	</h2>

	<span class="meta published">on <?php 
    echo $item_published;
    ?>
</span>
</div>

<div class="body"><?php 
    echo $item_content;
    ?>
</div>

<?php 
    $widgets = fof_get_widgets($item);
    $widgets[] = '<a href="#" onclick="return ajax_mark_read(\'' . $item_id . '\');">mark read</a>';
    if (!empty($widgets)) {
        echo '<div class="clearer"></div>' . "\n";
        echo '<div class="widgets">';
        foreach ($widgets as $widget) {
            echo '<span class="widget">' . $widget . "</span>";
        }
        echo "</div>\n";
    }
    if ($include_div) {
        echo "</div>\n";
    }
}
示例#5
0
        }
    }
}
$item_controls .= '</li>';
$item_controls .= '	<li class="orderby">';
if ($order == 'asc') {
    $item_controls .= '<a href="' . fof_url('.', array_merge($qv, array('order' => 'desc'))) . '">';
}
$item_controls .= '[new to old]';
if ($order == 'asc') {
    $item_controls .= '</a>';
}
$item_controls .= "</li>\n";
$item_controls .= '	<li class="orderby">';
if ($order == 'desc') {
    $item_controls .= '<a href="' . fof_url('.', array_merge($qv, array('order' => 'asc'))) . '">';
}
$item_controls .= '[old to new]';
if ($order == 'desc') {
    $item_controls .= '</a>';
}
$item_controls .= "</li>\n";
$item_controls .= '	<li><a href="#" onclick="flag_all();mark_read();return false;"><strong>Mark all read</strong></a></li>';
$item_controls .= '	<li><a href="#" onclick="flag_all();return false;">Flag all</a></li>';
$item_controls .= '	<li><a href="#" onclick="unflag_all();return false;">Unflag all</a></li>';
$item_controls .= '	<li><a href="#" onclick="toggle_all();return false;">Toggle all</a></li>';
$item_controls .= '	<li><a href="#" onclick="mark_read();return false;"><strong>Mark flagged read</strong></a></li>';
$item_controls .= '	<li><a href="#" onclick="mark_unread();return false;">Mark flagged unread</a></li>';
$item_controls .= '	<li><a href="#" onclick="show_all();return false;">Show all</a></li>';
$item_controls .= '	<li><a href="#" onclick="hide_all();return false;">Hide all</a></li>';
$item_controls .= '	<li><a href="#" onclick="untag_all();return false;">Untag all</a></li>';
示例#6
0
function fof_render_feed_row($f)
{
    global $fof_asset;
    global $fof_prefs_obj;
    $out = '';
    /* provide some reasonable fallbacks when things aren't set */
    $link = $f['feed_link'] == '[no link]' ? $f['feed_url'] : $f['feed_link'];
    $title = empty($f['display_title']) ? $f['feed_title'] : $f['display_title'];
    if (empty($title) || $title == '[no title]') {
        $title = $link;
    }
    $title_json = htmlentities(json_encode($title), ENT_QUOTES);
    /* show desired feed icon, if any at all */
    if ($fof_prefs_obj->get('favicons')) {
        $image = empty($f['display_image']) ? $f['feed_image'] : $f['display_image'];
    }
    /* otherwise show default */
    if (empty($image)) {
        $image = $fof_asset['feed_icon'];
    }
    /* however, if a feed failed to update, show an alert */
    if (!empty($f['feed_cache_last_attempt_status'])) {
        $image = $fof_asset['alert_icon'];
    }
    $image_html = '<img class="feed-icon" src="' . htmlentities($image, ENT_QUOTES) . '"' . (empty($f['feed_cache_last_attempt_status']) ? '' : ' title="Last update attempt was not successful." alt="' . htmlentities($f['feed_cache_last_attempt_status'], ENT_QUOTES) . '"') . '>';
    $unread = empty($f['feed_unread']) ? 0 : $f['feed_unread'];
    $items = empty($f['feed_items']) ? 0 : $f['feed_items'];
    $starred = empty($f['feed_starred']) ? 0 : $f['feed_starred'];
    $tagged = empty($f['feed_tagged']) ? 0 : $f['feed_tagged'];
    $feed_view_unread_url = fof_url('.', array('feed' => $f['feed_id'], 'how' => 'paged'));
    $feed_view_all_url = fof_url('.', array('feed' => $f['feed_id'], 'how' => 'paged', 'what' => 'all'));
    $feed_unsubscribe_url = fof_url('delete.php', array('feed' => $f['feed_id']));
    $feed_update_url = fof_url('update.php', array('feed' => $f['feed_id']));
    switch ($fof_prefs_obj->get('sidebar_style')) {
        case 'simple':
            /* feed_url feed_unread feed_title */
            $out .= '	<td class="source"><a href="' . $f['feed_url'] . '" title="feed">' . $image_html . '</a></td>' . "\n";
            $out .= '	<td class="unread">' . (empty($unread) ? '' : $unread) . '</td>';
            $out .= '	<td class="title"><a href="' . ($unread ? $feed_view_unread_url : $feed_view_all_url) . '">' . $title . '</a></td>' . "\n";
            /* controls */
            $out .= '	<td class="controls"><a href="' . $feed_unsubscribe_url . '" title="delete" onclick="return sb_unsub_conf(' . $title_json . ');">[x]</a></td>' . "\n";
            break;
        case 'fancy':
            /* feed_url max_date feed_unread feed_title */
            $out .= '	<td class="source"><a href="' . $link . '" ' . ($fof_prefs_obj->get('item_target') ? ' target="_blank"' : '') . '>' . $image_html . '</a></td>' . "\n";
            $out .= '	<td class="latest"><span title="' . $f['lateststr'] . '" id="' . $f['feed_id'] . '-lateststr">' . $f['lateststrabbr'] . '</span></td>' . "\n";
            $out .= '	<td class="unread"><span class="nowrap" id="' . $f['feed_id'] . '-items">';
            if ($unread) {
                $out .= '<a class="unread" title="' . $unread . ' unread items" href="' . $feed_view_unread_url . '">' . $unread . '</a>';
            }
            $out .= '</span></td>' . "\n";
            $out .= '	<td class="title"><a href="' . ($unread ? $feed_view_unread_url : $feed_view_all_url) . '" title="' . ($unread ? $unread . ' new of ' : '') . $items . ' total items">' . $title . '</a></td>' . "\n";
            /* controls */
            $out .= '	<td class="controls">';
            $out .= '<ul class="feedmenu">';
            $out .= '<li>';
            $out .= '<a href="#" title="feed controls">&Delta;</a>';
            $out .= '<ul>';
            $out .= '<li><a href="#" title="last update ' . $f['agestr'] . '" onclick="return sb_update_feed(' . $f['feed_id'] . ');">Update Feed</a></li>';
            $out .= '<li><a href="#" title="mark all as read" onclick="return sb_readall_feed(' . $f['feed_id'] . ')">Mark all items as read</a></li>';
            $out .= '<li><a href="' . $feed_view_all_url . '" title="' . $items . ' total items">View all items</a></li>';
            $out .= '<li><a href="' . fof_url('feed-detail.php', array('feed' => $f['feed_id'])) . '">Feed details</a></li>';
            $out .= '<li><a href="' . $link . '" title="home page"' . ($fof_prefs_obj->get('item_target') ? ' target="_blank"' : '') . '>Feed Source Site</a></li>';
            $out .= '<li><a href="' . $feed_unsubscribe_url . '" title="unsubscribe" onclick="return sb_unsub_conf(' . $title_json . ');">Unsubscribe from feed</a></li>';
            $out .= '</ul>';
            $out .= '</li>';
            $out .= '</ul>';
            $out .= '</td>' . "\n";
            break;
        default:
            /* feed_age max_date feed_unread feed_url feed_title */
            $out .= '	<td class="updated"><span title="' . $f['agestr'] . '" id="' . $f['feed_id'] . '-agestr">' . $f['agestrabbr'] . '</span></td>' . "\n";
            $out .= '	<td class="latest"><span title="' . $f['lateststr'] . '" id="' . $f['feed_id'] . '-lateststr">' . $f['lateststrabbr'] . '</span></td>' . "\n";
            $out .= '	<td style="unread" class="nowrap" id="' . $f['feed_id'] . '-items">';
            if ($unread) {
                $out .= '<a class="unread" title="new items" href="' . $feed_view_unread_url . '">' . $unread . '</a>/';
            }
            $out .= '<a href="' . $feed_view_all_url . '" title="all items, ' . $starred . ' starred, ' . $tagged . ' tagged">' . $items . '</a>';
            $out .= '</td>' . "\n";
            $out .= '	<td class="source"><a href="' . $f['feed_url'] . '">' . $image_html . '</a>' . "\n";
            $out .= '	<td class="title"><a href="' . $link . '" title="home page"' . ($fof_prefs_obj->get('item_target') ? ' target="_blank"' : '') . '><b>' . $title . '</b></a></td>' . "\n";
            /* controls */
            $out .= '	<td class="controls"><span class="nowrap">';
            $out .= ' <a href="' . $feed_update_url . '" title="update">u</a>';
            $out .= ' <a href="#" title="mark all read" onclick="return sb_read_conf(' . $title_json . ', ' . $f['feed_id'] . ');">m</a>';
            $out .= ' <a href="' . $feed_unsubscribe_url . '" title="delete" onclick="return sb_unsub_conf(' . $title_json . ');">d</a>';
            $out .= '</span></td>' . "\n";
            break;
    }
    return $out;
}