item sharing

orig_fof
steveminutillo 2007-06-25 04:13:18 +00:00
parent 70a17c0cdf
commit 539577ac99
6 changed files with 166 additions and 0 deletions

View File

@ -66,6 +66,7 @@ class FoF_Prefs
"keyboard" => false,
"direction" => "desc",
"howmany" => 50,
"sharing" => "no",
);
$admin_defaults = array(

BIN
plugins/share-off.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 553 B

BIN
plugins/share-on.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

20
plugins/sharing.php Normal file
View File

@ -0,0 +1,20 @@
<?php
fof_add_item_widget('fof_sharing');
function fof_sharing($item)
{
$prefs = fof_prefs();
$sharing = $prefs['sharing'];
if($sharing != "tagged") return false;
$tags = $item['tags'];
$id = $item['item_id'];
$shared = in_array("shared", $tags) ? true : false;
$shared_image = $shared ? "plugins/share-on.gif" : "plugins/share-off.gif";
$shared_link = $shared ? "javascript:remove_tag($id, 'shared')" : "javascript:add_tag($id, 'shared')";
$shared_text = $shared ? "shared" : "not shared";
return "<a href=\"$shared_link\"><img src=\"$shared_image\" width=\"12\" height=\"12\" /></a> <a href=\"$shared_link\">$shared_text</a> ";
}
?>

View File

@ -60,6 +60,9 @@ if(isset($_POST['prefs']))
$prefs->set('tzoffset', intval($_POST['tzoffset']));
$prefs->set('howmany', intval($_POST['howmany']));
$prefs->set('order', $_POST['order']);
$prefs->set('sharing', $_POST['sharing']);
$prefs->set('sharedname', $_POST['sharedname']);
$prefs->set('sharedurl', $_POST['sharedurl']);
foreach(fof_get_plugin_prefs() as $plugin_pref)
{
@ -140,6 +143,19 @@ Time offset in hours: <input size=3 type=string name=tzoffset value="<?php echo
<tr><td>Repeat new password:</td><td><input type=password name=password2></td></tr></table>
<br>
Share
<select name="sharing">
<option value=no>no</option>
<option value=all <?php if($prefs->get('sharing') == "all") echo "selected";?>>all</option>
<option value=tagged <?php if($prefs->get('sharing') == "tagged") echo "selected";?>>tagged as "shared"</option>
</select>
items.
<?php if($prefs->get('sharing') != "no") echo " <small><i>(your shared page is <a href='./shared.php?user=$fof_user_id'>here</a>)</i></small>";?><br><br>
Name to be shown on shared page: <input type=string name=sharedname value="<?php echo $prefs->get('sharedname')?>"><br><br>
URL to be linked on shared page: <input type=string name=sharedurl value="<?php echo $prefs->get('sharedurl')?>">
<br><br>
<?php foreach(fof_get_plugin_prefs() as $plugin_pref) { $name = $plugin_pref[0]; $key = $plugin_pref[1]; ?>
<?php echo $name ?>: <input name="<?php echo $key ?>" value="<?php echo $prefs->get($key)?>"> <i><small>(this preference is from a plugin)</small></i><br><br>
<?php } ?>

129
shared.php Normal file
View File

@ -0,0 +1,129 @@
<?php
/*
* This file is part of FEED ON FEEDS - http://feedonfeeds.com/
*
* shared.php - display shared items for a user
*
*
* Copyright (C) 2004-2007 Stephen Minutillo
* steve@minutillo.com - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
*
*/
$fof_no_login = true;
include_once("fof-main.php");
include_once("fof-render.php");
$user = $_GET['user'];
if(!isset($user)) die;
$prefs = new FoF_Prefs($user);
$sharing = $prefs->get("sharing");
if($sharing == "no") die;
$name = $prefs->get("sharedname");
$url = $prefs->get("sharedurl");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Feed on Feeds - Shared Items<?php if($name) echo " from $name" ?></title>
<link rel="stylesheet" href="fof.css" media="screen" />
<style>
.box
{
font-family: georgia;
background: #eee;
border: 1px solid black;
width: 30em;
margin: 10px auto 20px;
padding: 1em;
text-align: center;
}
</style>
</head>
<body>
<h1 class="box"><a href="http://feedonfeeds.com/">Feed on Feeds</a> - Shared Items
<?php if($name) echo " from" ?>
<?php if($url) echo "<a href='$url'>" ?>
<?php if($name) echo "$name" ?>
<?php if($url) echo "</a>" ?>
</h1>
<div id="items">
<?php
$which = ($sharing == "all") ? "all" : "shared";
$result = fof_get_items($user, NULL, $which, NULL, NULL, 100);
$first = true;
foreach($result as $item)
{
$item_id = $item['item_id'];
print '<div class="item shown" id="i' . $item_id . '">';
$feed_link = $item['feed_link'];
$feed_title = $item['feed_title'];
$feed_image = $item['feed_image'];
$feed_description = $item['feed_description'];
$item_link = $item['item_link'];
$item_id = $item['item_id'];
$item_title = $item['item_title'];
$item_content = $item['item_content'];
$item_read = $item['item_read'];
$item_published = gmdate("Y-n-d g:ia", $item['item_published'] + $offset*60*60);
$item_cached = gmdate("Y-n-d g:ia", $item['item_cached'] + $offset*60*60);
$item_updated = gmdate("Y-n-d g:ia", $item['item_updated'] + $offset*60*60);
if(!$item_title) $item_title = "[no title]";
?>
<div class="header">
<h1>
<a href="<?php echo $item_link ?>">
<?php echo $item_title ?>
</a>
</h1>
<span class='dash'> - </span>
<h2>
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><img src="<?php echo $feed_image ?>" height="16" width="16" border="0" /></a>
<a href="<?php echo $feed_link ?>" title='<?php echo $feed_description ?>'><?php echo $feed_title ?></a>
</h2>
<span class="meta">on <?php echo $item_published ?> GMT</span>
</div>
<div class="body"><?php echo $item_content ?></div>
<div class="clearer"></div>
</div>
<?php
}
if(count($result) == 0)
{
echo "<p><i>No shared items.</i></p>";
}
?>
</div></body></html>