2007-01-02 04:41:22 +03:00
< ? php
/*
* This file is part of FEED ON FEEDS - http :// feedonfeeds . com /
*
* add . php - displays form to add a feed
*
*
* Copyright ( C ) 2004 - 2007 Stephen Minutillo
* steve @ minutillo . com - http :// minutillo . com / steve /
*
* Distributed under the GPL - see LICENSE
*
*/
2007-06-09 09:43:38 +04:00
include ( " header.php " );
2007-03-14 06:55:17 +03:00
2007-01-02 04:41:22 +03:00
$url = $_POST [ 'rss_url' ];
if ( ! $url ) $url = $_GET [ 'rss_url' ];
$opml = $_POST [ 'opml_url' ];
$file = $_POST [ 'opml_file' ];
2007-06-23 07:56:58 +04:00
$unread = $_POST [ 'unread' ];
2007-01-02 04:41:22 +03:00
$feeds = array ();
2007-06-09 08:03:59 +04:00
if ( $url ) $feeds [] = $url ;
2007-01-02 04:41:22 +03:00
if ( $opml )
{
2007-06-05 06:07:01 +04:00
$sfile = new SimplePie_File ( $opml );
if ( ! $sfile -> success )
2007-01-02 04:41:22 +03:00
{
2011-05-24 05:27:47 +04:00
echo " Cannot open " . htmlentities ( $opml ) . " <br> " ;
2007-01-02 04:41:22 +03:00
return false ;
}
2007-06-05 06:07:01 +04:00
$content = $sfile -> body ;
2007-01-02 04:41:22 +03:00
$feeds = fof_opml_to_array ( $content );
}
if ( $_FILES [ 'opml_file' ][ 'tmp_name' ])
{
if ( ! $content_array = file ( $_FILES [ 'opml_file' ][ 'tmp_name' ]))
{
echo " Cannot open uploaded file<br> " ;
}
2007-06-09 08:03:59 +04:00
else
{
$content = implode ( " " , $content_array );
$feeds = fof_opml_to_array ( $content );
}
2007-01-02 04:41:22 +03:00
}
2007-08-16 08:21:35 +04:00
$add_feed_url = " http " ;
if ( $_SERVER [ " HTTPS " ] == " on " )
{
$add_feed_url = " https " ;
}
$add_feed_url .= " :// " . $_SERVER [ " HTTP_HOST " ] . $_SERVER [ " SCRIPT_NAME " ];
2007-06-09 09:43:38 +04:00
?>
2007-06-09 08:03:59 +04:00
2007-08-16 08:21:35 +04:00
< div style = " background: #eee; border: 1px solid black; padding: 1.5em; margin: 1.5em; " > If your browser is cool , you can < a href = 'javascript:window.navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", "<?php echo $add_feed_url ?>?rss_url=%s", "Feed on Feeds")' > register Feed on Feeds as a Feed Reader </ a >. If it is not cool , you can still use the < a href = " javascript:void(location.href='<?php echo $add_feed_url ?>?rss_url='+escape(location)) " > FoF subscribe </ a > bookmarklet to subscribe to any page with a feed . Just add it as a bookmark and then click on it when you are at a page you ' d like to subscribe to !</ div >
2007-01-02 04:41:22 +03:00
2007-06-10 09:39:32 +04:00
< form method = " post " action = " opml.php " >
2007-06-23 07:56:58 +04:00
2007-06-10 09:39:32 +04:00
< input type = " submit " value = " Export subscriptions as OPML " >
2007-06-23 07:56:58 +04:00
</ form >
2007-06-10 09:39:32 +04:00
< br >
2007-06-23 07:56:58 +04:00
< form method = " post " name = " addform " action = " add.php " enctype = " multipart/form-data " >
When adding feeds , mark < select name = " unread " >< option value = today < ? php if ( $unread == " today " ) echo " selected " ?> >today's</option><option value=all <?php if($unread == "all") echo "selected" ?> >all</option><option value=no <?php if($unread == "no") echo "selected" ?> >no</option></select> items as unread<br><br>
2007-06-09 08:03:59 +04:00
2011-05-24 05:27:47 +04:00
RSS or weblog URL : < input type = " text " name = " rss_url " size = " 40 " value = " <?php echo htmlentities( $url ) ?> " >< input type = " Submit " value = " Add a feed " >< br >< br >
2007-06-09 08:03:59 +04:00
2007-06-09 09:43:38 +04:00
OPML URL : < input type = " hidden " name = " MAX_FILE_SIZE " value = " 100000 " >
2011-05-24 05:27:47 +04:00
< input type = " text " name = " opml_url " size = " 40 " value = " <?php echo htmlentities( $opml ) ?> " >< input type = " Submit " value = " Add feeds from OPML file on the Internet " >< br >< br >
2007-06-09 09:43:38 +04:00
< input type = " hidden " name = " MAX_FILE_SIZE " value = " 100000 " >
2011-05-24 05:27:47 +04:00
OPML filename : < input type = " file " name = " opml_file " size = " 40 " value = " <?php echo htmlentities( $file ) ?> " >< input type = " Submit " value = " Upload an OPML file " >
2007-06-09 09:43:38 +04:00
</ form >
< ? php
if ( count ( $feeds ))
{
print ( " <script> \n window.onload = ajaxadd; \n feedslist = [ " );
foreach ( $feeds as $feed )
{
$feedjson [] = " { 'url': ' " . addslashes ( $feed ) . " '} " ;
}
print ( join ( $feedjson , " , " ));
print ( " ]; \n </script> " );
}
print ( " <br> " );
2007-06-09 08:03:59 +04:00
2007-01-02 04:41:22 +03:00
include ( " footer.php " );
?>