rss feed //todo - reordering support //todo - floatable description thingies ala netflix //todo - most recent - most popular //todo - tags - registration to claim a page - ajaxify - feedify define('MAGPIE_OUTPUT_ENCODING', 'UTF-8'); define('MAGPIE_INPUT_ENCODING', 'UTF-8'); define('MAGPIE_CACHE_DIR', '/tmp/.magpieCache'); define('MAGPIE_CACHE_ON', TRUE); define('MAGPIE_USER_AGENT', 'BozPages - http://swik.net/BozPages'); require_once('../magpierss-0.71.1/rss_fetch.inc'); require_once('utilities.php'); require_once('findReferences.php'); $mlink = mysql_connect("localhost","root","12345") or die(mysql_error()); mysql_select_db("bozpages") or die(mysql_error()); mysql_query("SET NAMES 'UTF8'"); //get boz id from get params function currentBozId() { $ids = array_keys($_GET); if ($ids[0] and strlen($ids[0]) < 8) return getDbBozId(Utilities::base36ToDecimal($ids[0])); else return NULL; } //confirm that a boz id exists and isn't a fake boz id function getDbBozId($id) { $sql = " SELECT id, hitCount, hash FROM bozpages WHERE id = $id "; $result = mysql_query($sql) or die($sql.mysql_error()); if ($row = mysql_fetch_assoc($result)) { $hc = $row['hitCount'] + 1; $hcSql = " UPDATE bozpages SET hitCount = $hc WHERE id = $id"; mysql_query($hcSql) or die($hcSql.mysql_error()); return array('id' => $id, 'hash' => $row['hash']); } else { header('Location: http://sandbox.sourcelabs.com/bozpage/'); //fake id goto homepage return NULL; } } function addBozHash($bozId, $feeds) { $feeds = array_unique($feeds); sort ($feeds); $sql = " UPDATE `bozpages` SET hash = '".mysql_real_escape_string( md5(implode('',$feeds)) )."' WHERE id = $bozId"; #var_dump($feeds); die(); mysql_query($sql) or die($sql.mysql_error()); } //find a bozId for a list of feeds function findBoz($feeds) { $feeds = array_unique($feeds); sort($feeds); $sql = " SELECT id FROM `bozpages` WHERE hash = '".mysql_real_escape_string( md5(implode('',$feeds)) )."'"; #var_dump($sql); die(); /* $sql = " SELECT feeds_for_page.boz_id as bozId FROM `feeds_for_page`, `feeds` WHERE feeds.id = feeds_for_page.feed_id AND feeds.url = '".mysql_real_escape_string($feeds[0])."'"; */ $result = mysql_query($sql) or die($sql.mysql_error()); $row = mysql_fetch_assoc($result); return $row['id']; } //convert a boz to an opml file function boz2opml($feedUrls) { header("Content-Type: text/xml"); echo " bozpage export "; if ($feedUrls) { foreach ($feedUrls as $feedUrl) { $rss = fetch_rss($feedUrl); echo " "; } } echo " "; die(''); } //convert an opml file to a boz page function opml2boz($url) { $xml = simplexml_load_file($url); $feedUrls = array(); foreach($xml->xpath('//@xmlUrl') as $feed) { $feedUrls[] = trim((string) $feed); } $bozId = feedUrlsToBoz($feedUrls); header('Location: http://sandbox.sourcelabs.com/bozpage/?'.Utilities::decimalToBase36($bozId)); //go to new bozpage } function feedUrlsToBoz($feedUrls) { //find which feeds are already in the database foreach ($feedUrls as $url) { $mysqlSafeFeeds[] = mysql_real_escape_string($url); } $urlSql = implode("' OR url = '",$mysqlSafeFeeds); $sql = <<items[0]['link']); var_dump(split('[\n\r]',$ws)); die(); */ } //add feeds to database or get their id foreach ($bUrls as $bu) { $bIds[] = getFeedId($bu); } $bozId = findBoz($bUrls); if (!$bozId) $bozId = createBozPage(); //create a new page //join feeds to a bozpage foreach ($bIds as $bi) { $sql = " INSERT INTO feeds_for_page SET feed_id = $bi, boz_id = $bozId"; mysql_query($sql) or die($sql.mysql_error()); } addBozHash($bozId, $bUrls); //go to new page header('Location: http://sandbox.sourcelabs.com/bozpage/?'.Utilities::decimalToBase36($bozId)); //go to new bozpage } if (isset($_POST['newsSearch']) and $_POST['newsSearch']) { $bozId = createBozPage(); //create a new page //make a feed list //go to new page } if (isset($_POST['wantSearch']) and $_POST['wantSearch']) { $bozId = createBozPage(); //create a new page //make a feed list //go to new page } ?> <? if ($bozId == NULL) echo "BozPages - Subscribe, Read, Fast, Simple"; else echo "BozPage (".Utilities::decimalToBase36($bozId).')'; ?>

BozPage (".Utilities::decimalToBase36($bozId).")"; ?> (Start New) • Add Feed • Cloud View • River View • post to del.icio.us

items[0]) { if ($rss->items[6]) findReferences($rss->items[rand(1, 3 )]['link']); findReferences($rss->items[0]['link']); } if ($rss->channel['title'] and $rss->items) { echo "

".$rss->channel['title']." XML

"; $i = 0; foreach ($rss->items as $item) { $entryDescription = (isset($item['atom_content']) and $item['atom_content']) ? $item['atom_content'] : $item['description']; $description = Utilities::escapeForJavascript( '
'.$entryDescription. ' '.$item['dc']['subject'].'
'); if (strlen($description) > 2000) $width = 800; elseif (strlen($description) > 500) $width = 500; else $width = 400; if ($item['title']) { $class = ($i % 2) ? 'odd' : ''; echo "

".$item['title']. '

'; $i++; if ($i > 7) break; //only show the first 10 items for brevity } } echo "
"; } } ?>
or opml: '>export

BozPages are simple one-off pages of RSS feeds, so you can keep track of a bunch of web pages in one place. Add a feed to start, or pick a template below:

tagging

BozPages - by Alex Bosworth at SourceLabs.

BozPages Wiki - Source Code coming soon