-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd.php
More file actions
executable file
·196 lines (174 loc) · 5.87 KB
/
add.php
File metadata and controls
executable file
·196 lines (174 loc) · 5.87 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
<?php
/*
* This file is part of Monkeychow - http://shokk.wordpress.com/tag/monkeychow/
*
* add.php - displays form to add a feed
*
* Copyright (C) 2006 Ernie Oporto
* ernieoporto@yahoo.com - http://shokk.wordpress.com
*
* Copyright (C) 2004 Stephen Minutillo
* steve@minutillo.com - http://minutillo.com/steve/
*
* Distributed under the GPL - see LICENSE
*
*/
include_once("init.php");
include_once("fof-main.php");
$ipod_font=8;
$nonipod_font=2;
header("Content-Type: text/html; charset=utf-8");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head><title>MonkeyChow - <?php echo _("Add a feed") ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="fof-common.css" media="all" />
<script src="fof.js" type="text/javascript"></script>
<meta name="ROBOTS" content="NOINDEX, NOFOLLOW" />
</head>
<body id="panel-page">
<?php
if (!preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT]))
{
?>
<script type="text/javascript" />
if (top==self) document.writeln('<?php
$handle = fopen("panel-menu.html", "r");
$xml = "";
if ($handle)
{
while (!feof($handle))
{
$xml .= fread($handle, 128);
}
fclose($handle);
}
$xml = substr("$xml", 0, -1); // Perl style chop
print $xml;
?>');
</script>
<?php
}
$url = $_REQUEST['rss_url'];
$opml = $_REQUEST['opml_url'];
$file = $_REQUEST['opml_file'];
if (!preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT]))
{
?>
<br /><br />
<table border=1 cellpadding=3 cellspacing=0 bgcolor="#EEEEEE"><tr><td>
<a href="javascript:void(location.href='http://<?php echo $_SERVER["HTTP_HOST"] . $_SERVER["SCRIPT_NAME"] ?>?rss_url='+escape(location))">Monkeychow <?php echo _("subscribe") ?></a> - <?php echo _("This bookmarklet will attempt to subscribe to whatever page you are on.") ?><br /><?php echo _("Drag it to your toolbar and then click on it when you are at a weblog you like.") ?>
</tr></td>
<tr><td>
<?php
if (ereg('Firefox/2.0', $_SERVER['HTTP_USER_AGENT'])) {
echo _("Firefox 2.0 detected! Click the following to add MonkeyChow to your Firefox 2.0 Feed Reader list!");
}
if (ereg('Firefox/3.0', $_SERVER['HTTP_USER_AGENT'])) {
echo _("Firefox 3.0 detected! Click the following to add MonkeyChow to your Firefox 3.0 Feed Reader list!");
}
?>
<br /><a href="" onclick="navigator.registerContentHandler('application/vnd.mozilla.maybe.feed','http://<?php echo $_SERVER["HTTP_HOST"] . dirname($_SERVER["SCRIPT_NAME"]) ?>/add.php?rss_url=%s','MonkeyChow');">Add MonkeyChow to Feed Reader List</a>
</tr></td></table>
<?php
}
?>
<br /><br />
<form method="post" action="add.php" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<li><font size="<?php
echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ? "$ipod_font": "$nonipod_font";
?>"><?php echo _("RSS or weblog URL"); ?>: <input type="text" name="rss_url" size="40" value="<?php echo $url ?>"<?php
if (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT]))
{
echo " style=\"font-size: 36px;\"";
}
?>
>
<input type="Submit" value="<?php echo _("Add a feed") ?>"<?php
if (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT]))
{
echo " style=\"font-size: 36px;\"";
}
?>
><br /><br />
</font></li>
</form>
<?php
if (!preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT]))
{
?>
<form method="post" action="add.php" enctype="multipart/form-data">
<?php echo _("OPML URL") ?>: <input type="hidden" name="MAX_FILE_SIZE" value="100000">
<input type="text" name="opml_url" size="40" value="<?php echo $opml ?>"><input type="Submit" value="<?php echo _("Add feeds from OPML file on the Internet") ?>"><br /><br />
</form>
<form method="post" action="add.php" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="100000">
<?php echo _("OPML filename"); ?>: <input type="file" name="opml_file" size="40" value="<?php echo $file ?>"><input type="Submit" value="<?php echo _("Upload an OPML file") ?>">
</form>
Note that anyone with a Google Reader account can use Google Takeout to download a zip file of their settings, which includes a Subscriptions.XML file that can be used as an OPML file above.
<?php
}
if($url) fof_add_feed($url);
if($opml)
{
if(!$content_array = file($opml))
{
echo _("Cannot open") . ": $opml <br />";
return false;
}
$content = implode("", $content_array);
$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 />";
return false;
}
$content = implode("", $content_array);
$feeds = fof_opml_to_array($content);
}
foreach ($feeds as $feed)
{
fof_add_feed($feed);
echo "<hr size=1>";
flush();
}
?>
<BR>
<?php
if (!preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT]))
{
?>
<script type="text/javascript" />
if (top==self) document.writeln('<?php
$handle = fopen("panel-menu.html", "r");
$xml = "";
if ($handle)
{
while (!feof($handle))
{
$xml .= fread($handle, 128);
}
fclose($handle);
}
$xml = substr("$xml", 0, -1); // Perl style chop
print $xml;
?>');
<?php
}
else
{
?><li><font size="<?php
echo (preg_match("/(wap|midp|cldc|mmp|Symbian|Smartphone|iPhone|WebKit.*Mobile)/si",$_SERVER[HTTP_USER_AGENT])) ? "$ipod_font": "$nonipod_font";
echo "\">";
echo "<a href=\"" . $_SERVER['HTTP_REFERER'] . "\">Return</a>";
echo "</font>";
}
?>
</script>
</body>
</html>