]>
Commit | Line | Data |
---|---|---|
5f0a3741 | 1 | <?php |
369dbc19 | 2 | class Handler_Public extends Handler { |
5f0a3741 | 3 | |
79178062 | 4 | private function generate_syndicated_feed($owner_uid, $feed, $is_cat, |
ca5d9be4 | 5 | $limit, $offset, $search, $search_mode, |
fcf6bfba | 6 | $view_mode = false, $format = 'atom', $order = false, $orig_guid = false) { |
79178062 AD |
7 | |
8 | require_once "lib/MiniTemplator.class.php"; | |
9 | ||
10 | $note_style = "background-color : #fff7d5; | |
11 | border-width : 1px; ". | |
12 | "padding : 5px; border-style : dashed; border-color : #e7d796;". | |
13 | "margin-bottom : 1em; color : #9a8c59;"; | |
14 | ||
2faef834 | 15 | if (!$limit) $limit = 60; |
79178062 | 16 | |
8aa01d79 | 17 | $date_sort_field = "date_entered DESC, updated DESC"; |
84c53d0e | 18 | $date_check_field = "date_entered"; |
79178062 | 19 | |
84c53d0e | 20 | if ($feed == -2 && !$is_cat) { |
7ef7dd31 | 21 | $date_sort_field = "last_published DESC"; |
84c53d0e AD |
22 | $date_check_field = "last_published"; |
23 | } else if ($feed == -1 && !$is_cat) { | |
7ef7dd31 | 24 | $date_sort_field = "last_marked DESC"; |
84c53d0e AD |
25 | $date_check_field = "last_marked"; |
26 | } | |
008ebad9 | 27 | |
25051fb8 AD |
28 | switch ($order) { |
29 | case "title": | |
30 | $date_sort_field = "ttrss_entries.title"; | |
31 | break; | |
32 | case "date_reverse": | |
33 | $date_sort_field = "date_entered, updated"; | |
34 | break; | |
35 | case "feed_dates": | |
36 | $date_sort_field = "updated DESC"; | |
37 | break; | |
38 | } | |
39 | ||
a42c55f0 | 40 | $qfh_ret = queryFeedHeadlines($feed, |
2e35a707 AD |
41 | 1, $view_mode, $is_cat, $search, $search_mode, |
42 | $date_sort_field, $offset, $owner_uid, | |
43 | false, 0, false, true); | |
44 | ||
45 | $result = $qfh_ret[0]; | |
46 | ||
d9c85e0f | 47 | if ($this->dbh->num_rows($result) != 0) { |
84c53d0e AD |
48 | |
49 | $ts = strtotime($this->dbh->fetch_result($result, 0, $date_check_field)); | |
2e35a707 AD |
50 | |
51 | if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && | |
d6ba77f3 | 52 | strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $ts) { |
2e35a707 AD |
53 | header('HTTP/1.0 304 Not Modified'); |
54 | return; | |
55 | } | |
56 | ||
57 | $last_modified = gmdate("D, d M Y H:i:s", $ts) . " GMT"; | |
58 | header("Last-Modified: $last_modified", true); | |
59 | } | |
60 | ||
a42c55f0 | 61 | $qfh_ret = queryFeedHeadlines($feed, |
79178062 | 62 | $limit, $view_mode, $is_cat, $search, $search_mode, |
8aa01d79 | 63 | $date_sort_field, $offset, $owner_uid, |
6b3f228f | 64 | false, 0, false, true); |
79178062 | 65 | |
2e35a707 | 66 | |
79178062 AD |
67 | $result = $qfh_ret[0]; |
68 | $feed_title = htmlspecialchars($qfh_ret[1]); | |
69 | $feed_site_url = $qfh_ret[2]; | |
70 | $last_error = $qfh_ret[3]; | |
71 | ||
72 | $feed_self_url = get_self_url_prefix() . | |
39119f02 JT |
73 | "/public.php?op=rss&id=$feed&key=" . |
74 | get_feed_access_key($feed, false, $owner_uid); | |
79178062 AD |
75 | |
76 | if (!$feed_site_url) $feed_site_url = get_self_url_prefix(); | |
77 | ||
2ebf38a9 AD |
78 | if ($format == 'atom') { |
79 | $tpl = new MiniTemplator; | |
79178062 | 80 | |
2ebf38a9 | 81 | $tpl->readTemplateFromFile("templates/generated_feed.txt"); |
79178062 | 82 | |
2ebf38a9 AD |
83 | $tpl->setVariable('FEED_TITLE', $feed_title, true); |
84 | $tpl->setVariable('VERSION', VERSION, true); | |
85 | $tpl->setVariable('FEED_URL', htmlspecialchars($feed_self_url), true); | |
79178062 | 86 | |
2ebf38a9 AD |
87 | if (PUBSUBHUBBUB_HUB && $feed == -2) { |
88 | $tpl->setVariable('HUB_URL', htmlspecialchars(PUBSUBHUBBUB_HUB), true); | |
89 | $tpl->addBlock('feed_hub'); | |
90 | } | |
79178062 | 91 | |
2ebf38a9 | 92 | $tpl->setVariable('SELF_URL', htmlspecialchars(get_self_url_prefix()), true); |
d9c85e0f | 93 | while ($line = $this->dbh->fetch_assoc($result)) { |
bc262b67 AD |
94 | $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...'); |
95 | ||
891e36f5 | 96 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
97 | $line = $p->hook_query_headlines($line); | |
98 | } | |
2e35a707 | 99 | |
fcf6bfba AD |
100 | $tpl->setVariable('ARTICLE_ID', |
101 | htmlspecialchars($orig_guid ? $line['link'] : | |
102 | get_self_url_prefix() . | |
103 | "/public.php?url=" . urlencode($line['link'])), true); | |
2ebf38a9 AD |
104 | $tpl->setVariable('ARTICLE_LINK', htmlspecialchars($line['link']), true); |
105 | $tpl->setVariable('ARTICLE_TITLE', htmlspecialchars($line['title']), true); | |
67631438 | 106 | $tpl->setVariable('ARTICLE_EXCERPT', $line["content_preview"], true); |
79178062 | 107 | |
891e36f5 | 108 | $content = sanitize($line["content"], false, $owner_uid); |
79178062 | 109 | |
2ebf38a9 AD |
110 | if ($line['note']) { |
111 | $content = "<div style=\"$note_style\">Article note: " . $line['note'] . "</div>" . | |
112 | $content; | |
e9c6e27d | 113 | $tpl->setVariable('ARTICLE_NOTE', htmlspecialchars($line['note']), true); |
114 | } | |
2ebf38a9 AD |
115 | |
116 | $tpl->setVariable('ARTICLE_CONTENT', $content, true); | |
117 | ||
118 | $tpl->setVariable('ARTICLE_UPDATED_ATOM', | |
119 | date('c', strtotime($line["updated"])), true); | |
120 | $tpl->setVariable('ARTICLE_UPDATED_RFC822', | |
121 | date(DATE_RFC822, strtotime($line["updated"])), true); | |
122 | ||
123 | $tpl->setVariable('ARTICLE_AUTHOR', htmlspecialchars($line['author']), true); | |
124 | ||
fcf6bfba | 125 | $tpl->setVariable('ARTICLE_SOURCE_LINK', htmlspecialchars($line['site_url']), true); |
ab10707f | 126 | $tpl->setVariable('ARTICLE_SOURCE_TITLE', htmlspecialchars($line['feed_title']), true); |
2ebf38a9 | 127 | |
a42c55f0 | 128 | $tags = get_article_tags($line["id"], $owner_uid); |
2ebf38a9 AD |
129 | |
130 | foreach ($tags as $tag) { | |
131 | $tpl->setVariable('ARTICLE_CATEGORY', htmlspecialchars($tag), true); | |
132 | $tpl->addBlock('category'); | |
133 | } | |
79178062 | 134 | |
a42c55f0 | 135 | $enclosures = get_article_enclosures($line["id"]); |
79178062 | 136 | |
2ebf38a9 AD |
137 | foreach ($enclosures as $e) { |
138 | $type = htmlspecialchars($e['content_type']); | |
139 | $url = htmlspecialchars($e['content_url']); | |
140 | $length = $e['duration']; | |
9c97041d | 141 | |
2ebf38a9 AD |
142 | $tpl->setVariable('ARTICLE_ENCLOSURE_URL', $url, true); |
143 | $tpl->setVariable('ARTICLE_ENCLOSURE_TYPE', $type, true); | |
144 | $tpl->setVariable('ARTICLE_ENCLOSURE_LENGTH', $length, true); | |
79178062 | 145 | |
2ebf38a9 AD |
146 | $tpl->addBlock('enclosure'); |
147 | } | |
79178062 | 148 | |
2ebf38a9 | 149 | $tpl->addBlock('entry'); |
79178062 AD |
150 | } |
151 | ||
2ebf38a9 AD |
152 | $tmp = ""; |
153 | ||
154 | $tpl->addBlock('feed'); | |
155 | $tpl->generateOutputToString($tmp); | |
156 | ||
10bdeb4b AD |
157 | if (@!$_REQUEST["noxml"]) { |
158 | header("Content-Type: text/xml; charset=utf-8"); | |
159 | } else { | |
160 | header("Content-Type: text/plain; charset=utf-8"); | |
161 | } | |
2ebf38a9 AD |
162 | |
163 | print $tmp; | |
164 | } else if ($format == 'json') { | |
79178062 | 165 | |
2ebf38a9 | 166 | $feed = array(); |
79178062 | 167 | |
2ebf38a9 AD |
168 | $feed['title'] = $feed_title; |
169 | $feed['version'] = VERSION; | |
170 | $feed['feed_url'] = $feed_self_url; | |
79178062 | 171 | |
2ebf38a9 AD |
172 | if (PUBSUBHUBBUB_HUB && $feed == -2) { |
173 | $feed['hub_url'] = PUBSUBHUBBUB_HUB; | |
79178062 AD |
174 | } |
175 | ||
2ebf38a9 AD |
176 | $feed['self_url'] = get_self_url_prefix(); |
177 | ||
178 | $feed['articles'] = array(); | |
179 | ||
d9c85e0f | 180 | while ($line = $this->dbh->fetch_assoc($result)) { |
575a5287 | 181 | $line["content_preview"] = truncate_string(strip_tags($line["content_preview"]), 100, '...'); |
891e36f5 | 182 | foreach (PluginHost::getInstance()->get_hooks(PluginHost::HOOK_QUERY_HEADLINES) as $p) { |
183 | $line = $p->hook_query_headlines($line, 100); | |
184 | } | |
2ebf38a9 | 185 | $article = array(); |
79178062 | 186 | |
2ebf38a9 AD |
187 | $article['id'] = $line['link']; |
188 | $article['link'] = $line['link']; | |
189 | $article['title'] = $line['title']; | |
67631438 | 190 | $article['excerpt'] = $line["content_preview"]; |
891e36f5 | 191 | $article['content'] = sanitize($line["content"], false, $owner_uid); |
2ebf38a9 | 192 | $article['updated'] = date('c', strtotime($line["updated"])); |
79178062 | 193 | |
2ebf38a9 AD |
194 | if ($line['note']) $article['note'] = $line['note']; |
195 | if ($article['author']) $article['author'] = $line['author']; | |
79178062 | 196 | |
a42c55f0 | 197 | $tags = get_article_tags($line["id"], $owner_uid); |
2ebf38a9 AD |
198 | |
199 | if (count($tags) > 0) { | |
200 | $article['tags'] = array(); | |
201 | ||
202 | foreach ($tags as $tag) { | |
203 | array_push($article['tags'], $tag); | |
204 | } | |
205 | } | |
206 | ||
a42c55f0 | 207 | $enclosures = get_article_enclosures($line["id"]); |
2ebf38a9 AD |
208 | |
209 | if (count($enclosures) > 0) { | |
210 | $article['enclosures'] = array(); | |
211 | ||
212 | foreach ($enclosures as $e) { | |
213 | $type = $e['content_type']; | |
214 | $url = $e['content_url']; | |
215 | $length = $e['duration']; | |
216 | ||
217 | array_push($article['enclosures'], array("url" => $url, "type" => $type, "length" => $length)); | |
218 | } | |
219 | } | |
220 | ||
221 | array_push($feed['articles'], $article); | |
222 | } | |
223 | ||
10bdeb4b | 224 | header("Content-Type: text/json; charset=utf-8"); |
2ebf38a9 AD |
225 | print json_encode($feed); |
226 | ||
227 | } else { | |
228 | header("Content-Type: text/plain; charset=utf-8"); | |
229 | print json_encode(array("error" => array("message" => "Unknown format"))); | |
230 | } | |
79178062 AD |
231 | } |
232 | ||
5f0a3741 | 233 | function getUnread() { |
d9c85e0f | 234 | $login = $this->dbh->escape_string($_REQUEST["login"]); |
5f0a3741 AD |
235 | $fresh = $_REQUEST["fresh"] == "1"; |
236 | ||
d9c85e0f | 237 | $result = $this->dbh->query("SELECT id FROM ttrss_users WHERE login = '$login'"); |
5f0a3741 | 238 | |
d9c85e0f AD |
239 | if ($this->dbh->num_rows($result) == 1) { |
240 | $uid = $this->dbh->fetch_result($result, 0, "id"); | |
5f0a3741 | 241 | |
a42c55f0 | 242 | print getGlobalUnread($uid); |
5f0a3741 AD |
243 | |
244 | if ($fresh) { | |
245 | print ";"; | |
a42c55f0 | 246 | print getFeedArticles(-3, false, true, $uid); |
5f0a3741 AD |
247 | } |
248 | ||
249 | } else { | |
250 | print "-1;User not found"; | |
251 | } | |
252 | ||
253 | } | |
254 | ||
255 | function getProfiles() { | |
d9c85e0f | 256 | $login = $this->dbh->escape_string($_REQUEST["login"]); |
5f0a3741 | 257 | |
0806d68b | 258 | $result = $this->dbh->query("SELECT ttrss_settings_profiles.* FROM ttrss_settings_profiles,ttrss_users |
97acbaf1 | 259 | WHERE ttrss_users.id = ttrss_settings_profiles.owner_uid AND login = '$login' ORDER BY title"); |
5f0a3741 | 260 | |
eeee2ccf | 261 | print "<select dojoType='dijit.form.Select' style='width : 220px; margin : 0px' name='profile'>"; |
5f0a3741 | 262 | |
97acbaf1 | 263 | print "<option value='0'>" . __("Default profile") . "</option>"; |
5f0a3741 | 264 | |
d9c85e0f | 265 | while ($line = $this->dbh->fetch_assoc($result)) { |
97acbaf1 AD |
266 | $id = $line["id"]; |
267 | $title = $line["title"]; | |
5f0a3741 | 268 | |
97acbaf1 | 269 | print "<option value='$id'>$title</option>"; |
5f0a3741 | 270 | } |
97acbaf1 AD |
271 | |
272 | print "</select>"; | |
5f0a3741 AD |
273 | } |
274 | ||
275 | function pubsub() { | |
d9c85e0f AD |
276 | $mode = $this->dbh->escape_string($_REQUEST['hub_mode']); |
277 | $feed_id = (int) $this->dbh->escape_string($_REQUEST['id']); | |
278 | $feed_url = $this->dbh->escape_string($_REQUEST['hub_topic']); | |
5f0a3741 AD |
279 | |
280 | if (!PUBSUBHUBBUB_ENABLED) { | |
281 | header('HTTP/1.0 404 Not Found'); | |
282 | echo "404 Not found"; | |
283 | return; | |
284 | } | |
285 | ||
286 | // TODO: implement hub_verifytoken checking | |
287 | ||
d9c85e0f | 288 | $result = $this->dbh->query("SELECT feed_url FROM ttrss_feeds |
5f0a3741 AD |
289 | WHERE id = '$feed_id'"); |
290 | ||
d9c85e0f | 291 | if ($this->dbh->num_rows($result) != 0) { |
5f0a3741 | 292 | |
d9c85e0f | 293 | $check_feed_url = $this->dbh->fetch_result($result, 0, "feed_url"); |
5f0a3741 AD |
294 | |
295 | if ($check_feed_url && ($check_feed_url == $feed_url || !$feed_url)) { | |
296 | if ($mode == "subscribe") { | |
297 | ||
d9c85e0f | 298 | $this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 2 |
5f0a3741 AD |
299 | WHERE id = '$feed_id'"); |
300 | ||
301 | print $_REQUEST['hub_challenge']; | |
302 | return; | |
303 | ||
304 | } else if ($mode == "unsubscribe") { | |
305 | ||
d9c85e0f | 306 | $this->dbh->query("UPDATE ttrss_feeds SET pubsub_state = 0 |
5f0a3741 AD |
307 | WHERE id = '$feed_id'"); |
308 | ||
309 | print $_REQUEST['hub_challenge']; | |
310 | return; | |
311 | ||
312 | } else if (!$mode) { | |
313 | ||
314 | // Received update ping, schedule feed update. | |
a42c55f0 | 315 | //update_rss_feed($feed_id, true, true); |
5f0a3741 | 316 | |
d9c85e0f | 317 | $this->dbh->query("UPDATE ttrss_feeds SET |
5f0a3741 AD |
318 | last_update_started = '1970-01-01', |
319 | last_updated = '1970-01-01' WHERE id = '$feed_id'"); | |
320 | ||
321 | } | |
322 | } else { | |
323 | header('HTTP/1.0 404 Not Found'); | |
324 | echo "404 Not found"; | |
325 | } | |
326 | } else { | |
327 | header('HTTP/1.0 404 Not Found'); | |
328 | echo "404 Not found"; | |
329 | } | |
330 | ||
331 | } | |
332 | ||
333 | function logout() { | |
334 | logout_user(); | |
335 | header("Location: index.php"); | |
336 | } | |
337 | ||
5f0a3741 | 338 | function share() { |
d9c85e0f | 339 | $uuid = $this->dbh->escape_string($_REQUEST["key"]); |
5f0a3741 | 340 | |
d9c85e0f | 341 | $result = $this->dbh->query("SELECT ref_id, owner_uid FROM ttrss_user_entries WHERE |
5f0a3741 AD |
342 | uuid = '$uuid'"); |
343 | ||
d9c85e0f | 344 | if ($this->dbh->num_rows($result) != 0) { |
5f0a3741 AD |
345 | header("Content-Type: text/html"); |
346 | ||
d9c85e0f AD |
347 | $id = $this->dbh->fetch_result($result, 0, "ref_id"); |
348 | $owner_uid = $this->dbh->fetch_result($result, 0, "owner_uid"); | |
5f0a3741 | 349 | |
a42c55f0 | 350 | $article = format_article($id, false, true, $owner_uid); |
5f0a3741 AD |
351 | |
352 | print_r($article['content']); | |
353 | ||
354 | } else { | |
355 | print "Article not found."; | |
356 | } | |
357 | ||
358 | } | |
359 | ||
360 | function rss() { | |
d9c85e0f AD |
361 | $feed = $this->dbh->escape_string($_REQUEST["id"]); |
362 | $key = $this->dbh->escape_string($_REQUEST["key"]); | |
356e13b1 | 363 | $is_cat = sql_bool_to_bool($_REQUEST["is_cat"]); |
d9c85e0f AD |
364 | $limit = (int)$this->dbh->escape_string($_REQUEST["limit"]); |
365 | $offset = (int)$this->dbh->escape_string($_REQUEST["offset"]); | |
5f0a3741 | 366 | |
d9c85e0f AD |
367 | $search = $this->dbh->escape_string($_REQUEST["q"]); |
368 | $search_mode = $this->dbh->escape_string($_REQUEST["smode"]); | |
369 | $view_mode = $this->dbh->escape_string($_REQUEST["view-mode"]); | |
25051fb8 | 370 | $order = $this->dbh->escape_string($_REQUEST["order"]); |
5f0a3741 | 371 | |
d9c85e0f | 372 | $format = $this->dbh->escape_string($_REQUEST['format']); |
356e13b1 | 373 | $orig_guid = !sql_bool_to_bool($_REQUEST["no_orig_guid"]); |
2ebf38a9 AD |
374 | |
375 | if (!$format) $format = 'atom'; | |
376 | ||
5f0a3741 | 377 | if (SINGLE_USER_MODE) { |
a42c55f0 | 378 | authenticate_user("admin", null); |
5f0a3741 AD |
379 | } |
380 | ||
381 | $owner_id = false; | |
382 | ||
383 | if ($key) { | |
d9c85e0f | 384 | $result = $this->dbh->query("SELECT owner_uid FROM |
5f0a3741 AD |
385 | ttrss_access_keys WHERE access_key = '$key' AND feed_id = '$feed'"); |
386 | ||
d9c85e0f AD |
387 | if ($this->dbh->num_rows($result) == 1) |
388 | $owner_id = $this->dbh->fetch_result($result, 0, "owner_uid"); | |
5f0a3741 AD |
389 | } |
390 | ||
391 | if ($owner_id) { | |
2fb947eb | 392 | $this->generate_syndicated_feed($owner_id, $feed, $is_cat, $limit, |
fcf6bfba | 393 | $offset, $search, $search_mode, $view_mode, $format, $order, $orig_guid); |
5f0a3741 AD |
394 | } else { |
395 | header('HTTP/1.1 403 Forbidden'); | |
396 | } | |
397 | } | |
398 | ||
910592b4 | 399 | function updateTask() { |
910592b4 AD |
400 | PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); |
401 | } | |
402 | ||
4e5ddeaf AD |
403 | function housekeepingTask() { |
404 | PluginHost::getInstance()->run_hooks(PluginHost::HOOK_HOUSE_KEEPING, "hook_house_keeping", $op); | |
405 | } | |
406 | ||
07391e36 | 407 | function globalUpdateFeeds() { |
113c3dec | 408 | RPC::updaterandomfeed_real($this->dbh); |
cda55d67 | 409 | |
1ffe3391 | 410 | PluginHost::getInstance()->run_hooks(PluginHost::HOOK_UPDATE_TASK, "hook_update_task", $op); |
07391e36 | 411 | } |
8361e724 AD |
412 | |
413 | function sharepopup() { | |
61a748f8 | 414 | if (SINGLE_USER_MODE) { |
6322ac79 | 415 | login_sequence(); |
61a748f8 AD |
416 | } |
417 | ||
8361e724 | 418 | header('Content-Type: text/html; charset=utf-8'); |
d0ee0f52 AD |
419 | print "<html><head><title>Tiny Tiny RSS</title> |
420 | <link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\"> | |
421 | <link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\">"; | |
9a2aed91 | 422 | |
5bbc4bb4 | 423 | stylesheet_tag("css/utility.css"); |
6f7798b6 RL |
424 | javascript_tag("lib/prototype.js"); |
425 | javascript_tag("lib/scriptaculous/scriptaculous.js?load=effects,dragdrop,controls"); | |
9a2aed91 AD |
426 | print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/> |
427 | </head><body id='sharepopup'>"; | |
8361e724 AD |
428 | |
429 | $action = $_REQUEST["action"]; | |
430 | ||
431 | if ($_SESSION["uid"]) { | |
432 | ||
d493aba2 | 433 | if ($action == 'share') { |
8361e724 | 434 | |
d9c85e0f AD |
435 | $title = $this->dbh->escape_string(strip_tags($_REQUEST["title"])); |
436 | $url = $this->dbh->escape_string(strip_tags($_REQUEST["url"])); | |
437 | $content = $this->dbh->escape_string(strip_tags($_REQUEST["content"])); | |
438 | $labels = $this->dbh->escape_string(strip_tags($_REQUEST["labels"])); | |
8361e724 | 439 | |
a42c55f0 | 440 | Article::create_published_article($title, $url, $content, $labels, |
1b4d1a6b | 441 | $_SESSION["uid"]); |
8361e724 | 442 | |
d493aba2 AD |
443 | print "<script type='text/javascript'>"; |
444 | print "window.close();"; | |
445 | print "</script>"; | |
8361e724 | 446 | |
d493aba2 | 447 | } else { |
8361e724 AD |
448 | $title = htmlspecialchars($_REQUEST["title"]); |
449 | $url = htmlspecialchars($_REQUEST["url"]); | |
450 | ||
d493aba2 | 451 | ?> |
8361e724 | 452 | |
d493aba2 AD |
453 | <table height='100%' width='100%'><tr><td colspan='2'> |
454 | <h1><?php echo __("Share with Tiny Tiny RSS") ?></h1> | |
455 | </td></tr> | |
8361e724 | 456 | |
d493aba2 | 457 | <form id='share_form' name='share_form'> |
8361e724 | 458 | |
d493aba2 AD |
459 | <input type="hidden" name="op" value="sharepopup"> |
460 | <input type="hidden" name="action" value="share"> | |
8361e724 | 461 | |
22439dad | 462 | <tr><td align='right'><?php echo __("Title:") ?></td> |
d493aba2 | 463 | <td width='80%'><input name='title' value="<?php echo $title ?>"></td></tr> |
22439dad | 464 | <tr><td align='right'><?php echo __("URL:") ?></td> |
d493aba2 | 465 | <td><input name='url' value="<?php echo $url ?>"></td></tr> |
22439dad | 466 | <tr><td align='right'><?php echo __("Content:") ?></td> |
d493aba2 | 467 | <td><input name='content' value=""></td></tr> |
1b4d1a6b AD |
468 | <tr><td align='right'><?php echo __("Labels:") ?></td> |
469 | <td><input name='labels' id="labels_value" | |
470 | placeholder='Alpha, Beta, Gamma' value=""> | |
471 | </td></tr> | |
472 | ||
473 | <tr><td> | |
474 | <div class="autocomplete" id="labels_choices" | |
475 | style="display : block"></div></td></tr> | |
8361e724 | 476 | |
d493aba2 | 477 | <script type='text/javascript'>document.forms[0].title.focus();</script> |
8361e724 | 478 | |
1b4d1a6b AD |
479 | <script type='text/javascript'> |
480 | new Ajax.Autocompleter('labels_value', 'labels_choices', | |
481 | "backend.php?op=rpc&method=completeLabels", | |
482 | { tokens: ',', paramName: "search" }); | |
483 | </script> | |
484 | ||
d493aba2 AD |
485 | <tr><td colspan='2'> |
486 | <div style='float : right' class='insensitive-small'> | |
487 | <?php echo __("Shared article will appear in the Published feed.") ?> | |
488 | </div> | |
489 | <button type="submit"><?php echo __('Share') ?></button> | |
490 | <button onclick="return window.close()"><?php echo __('Cancel') ?></button> | |
491 | </div> | |
8361e724 | 492 | |
d493aba2 AD |
493 | </form> |
494 | </td></tr></table> | |
495 | </body></html> | |
496 | <?php | |
8361e724 | 497 | |
8361e724 AD |
498 | } |
499 | ||
500 | } else { | |
501 | ||
d493aba2 AD |
502 | $return = urlencode($_SERVER["REQUEST_URI"]) |
503 | ?> | |
504 | ||
505 | <form action="public.php?return=<?php echo $return ?>" | |
22439dad | 506 | method="POST" id="loginForm" name="loginForm"> |
d493aba2 AD |
507 | |
508 | <input type="hidden" name="op" value="login"> | |
509 | ||
510 | <table height='100%' width='100%'><tr><td colspan='2'> | |
22439dad | 511 | <h1><?php echo __("Not logged in") ?></h1></td></tr> |
d493aba2 AD |
512 | |
513 | <tr><td align="right"><?php echo __("Login:") ?></td> | |
514 | <td align="right"><input name="login" | |
515 | value="<?php echo $_SESSION["fake_login"] ?>"></td></tr> | |
516 | <tr><td align="right"><?php echo __("Password:") ?></td> | |
517 | <td align="right"><input type="password" name="password" | |
518 | value="<?php echo $_SESSION["fake_password"] ?>"></td></tr> | |
d493aba2 AD |
519 | <tr><td colspan='2'> |
520 | <button type="submit"> | |
521 | <?php echo __('Log in') ?></button> | |
522 | ||
523 | <button onclick="return window.close()"> | |
524 | <?php echo __('Cancel') ?></button> | |
525 | </td></tr> | |
526 | </table> | |
527 | ||
528 | </form> | |
529 | <?php | |
8361e724 AD |
530 | } |
531 | } | |
532 | ||
97acbaf1 | 533 | function login() { |
97acbaf1 AD |
534 | if (!SINGLE_USER_MODE) { |
535 | ||
d9c85e0f | 536 | $login = $this->dbh->escape_string($_POST["login"]); |
97acbaf1 | 537 | $password = $_POST["password"]; |
aadd636a | 538 | $remember_me = $_POST["remember_me"]; |
97acbaf1 | 539 | |
f231f438 AD |
540 | if ($remember_me) { |
541 | session_set_cookie_params(SESSION_COOKIE_LIFETIME); | |
542 | } else { | |
543 | session_set_cookie_params(0); | |
544 | } | |
545 | ||
aadd636a | 546 | @session_start(); |
60ed4c9a | 547 | |
a42c55f0 | 548 | if (authenticate_user($login, $password)) { |
97acbaf1 AD |
549 | $_POST["password"] = ""; |
550 | ||
b18d109f AD |
551 | if (get_schema_version() >= 120) { |
552 | $_SESSION["language"] = get_pref("USER_LANGUAGE", $_SESSION["uid"]); | |
553 | } | |
554 | ||
a42c55f0 | 555 | $_SESSION["ref_schema_version"] = get_schema_version(true); |
97acbaf1 AD |
556 | $_SESSION["bw_limit"] = !!$_POST["bw_limit"]; |
557 | ||
558 | if ($_POST["profile"]) { | |
559 | ||
d9c85e0f | 560 | $profile = $this->dbh->escape_string($_POST["profile"]); |
97acbaf1 | 561 | |
d9c85e0f | 562 | $result = $this->dbh->query("SELECT id FROM ttrss_settings_profiles |
97acbaf1 AD |
563 | WHERE id = '$profile' AND owner_uid = " . $_SESSION["uid"]); |
564 | ||
d9c85e0f | 565 | if ($this->dbh->num_rows($result) != 0) { |
97acbaf1 | 566 | $_SESSION["profile"] = $profile; |
97acbaf1 AD |
567 | } |
568 | } | |
569 | } else { | |
570 | $_SESSION["login_error_msg"] = __("Incorrect username or password"); | |
c4cab4ec | 571 | user_error("Failed login attempt from {$_SERVER['REMOTE_ADDR']}", E_USER_WARNING); |
97acbaf1 AD |
572 | } |
573 | ||
574 | if ($_REQUEST['return']) { | |
575 | header("Location: " . $_REQUEST['return']); | |
576 | } else { | |
577 | header("Location: " . SELF_URL_PATH); | |
578 | } | |
579 | } | |
580 | } | |
581 | ||
582 | function subscribe() { | |
61a748f8 | 583 | if (SINGLE_USER_MODE) { |
6322ac79 | 584 | login_sequence(); |
61a748f8 AD |
585 | } |
586 | ||
97acbaf1 AD |
587 | if ($_SESSION["uid"]) { |
588 | ||
d9c85e0f | 589 | $feed_url = $this->dbh->escape_string(trim($_REQUEST["feed_url"])); |
97acbaf1 AD |
590 | |
591 | header('Content-Type: text/html; charset=utf-8'); | |
592 | print "<html> | |
593 | <head> | |
594 | <title>Tiny Tiny RSS</title> | |
5bbc4bb4 | 595 | <link rel=\"stylesheet\" type=\"text/css\" href=\"css/utility.css\"> |
97acbaf1 | 596 | <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/> |
d0ee0f52 AD |
597 | <link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\"> |
598 | <link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\"> | |
599 | ||
97acbaf1 AD |
600 | </head> |
601 | <body> | |
884d1650 | 602 | <img class=\"floatingLogo\" src=\"images/logo_small.png\" |
97acbaf1 | 603 | alt=\"Tiny Tiny RSS\"/> |
884d1650 | 604 | <h1>".__("Subscribe to feed...")."</h1><div class='content'>"; |
97acbaf1 | 605 | |
a42c55f0 | 606 | $rc = subscribe_to_feed($feed_url); |
97acbaf1 AD |
607 | |
608 | switch ($rc['code']) { | |
609 | case 0: | |
610 | print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); | |
611 | break; | |
612 | case 1: | |
613 | print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); | |
614 | break; | |
615 | case 2: | |
616 | print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); | |
617 | break; | |
618 | case 3: | |
619 | print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url)); | |
620 | break; | |
621 | case 4: | |
622 | print_notice(__("Multiple feed URLs found.")); | |
759e5132 | 623 | $feed_urls = $rc["feeds"]; |
97acbaf1 AD |
624 | break; |
625 | case 5: | |
626 | print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url)); | |
627 | break; | |
628 | } | |
629 | ||
630 | if ($feed_urls) { | |
631 | ||
632 | print "<form action=\"public.php\">"; | |
633 | print "<input type=\"hidden\" name=\"op\" value=\"subscribe\">"; | |
634 | ||
635 | print "<select name=\"feed_url\">"; | |
636 | ||
637 | foreach ($feed_urls as $url => $name) { | |
638 | $url = htmlspecialchars($url); | |
639 | $name = htmlspecialchars($name); | |
640 | ||
641 | print "<option value=\"$url\">$name</option>"; | |
642 | } | |
643 | ||
644 | print "<input type=\"submit\" value=\"".__("Subscribe to selected feed"). | |
645 | "\">"; | |
646 | ||
647 | print "</form>"; | |
648 | } | |
649 | ||
650 | $tp_uri = get_self_url_prefix() . "/prefs.php"; | |
651 | $tt_uri = get_self_url_prefix(); | |
652 | ||
653 | if ($rc['code'] <= 2){ | |
d9c85e0f | 654 | $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE |
97acbaf1 AD |
655 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); |
656 | ||
d9c85e0f | 657 | $feed_id = $this->dbh->fetch_result($result, 0, "id"); |
97acbaf1 AD |
658 | } else { |
659 | $feed_id = 0; | |
660 | } | |
661 | print "<p>"; | |
662 | ||
663 | if ($feed_id) { | |
664 | print "<form method=\"GET\" style='display: inline' | |
665 | action=\"$tp_uri\"> | |
666 | <input type=\"hidden\" name=\"tab\" value=\"feedConfig\"> | |
667 | <input type=\"hidden\" name=\"method\" value=\"editFeed\"> | |
668 | <input type=\"hidden\" name=\"methodparam\" value=\"$feed_id\"> | |
669 | <input type=\"submit\" value=\"".__("Edit subscription options")."\"> | |
670 | </form>"; | |
671 | } | |
672 | ||
673 | print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\"> | |
674 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
675 | </form></p>"; | |
676 | ||
884d1650 | 677 | print "</div></body></html>"; |
97acbaf1 AD |
678 | |
679 | } else { | |
6322ac79 | 680 | render_login_form(); |
97acbaf1 AD |
681 | } |
682 | } | |
683 | ||
684 | function subscribe2() { | |
d9c85e0f AD |
685 | $feed_url = $this->dbh->escape_string(trim($_REQUEST["feed_url"])); |
686 | $cat_id = $this->dbh->escape_string($_REQUEST["cat_id"]); | |
687 | $from = $this->dbh->escape_string($_REQUEST["from"]); | |
6f7798b6 | 688 | $feed_urls = array(); |
97acbaf1 AD |
689 | |
690 | /* only read authentication information from POST */ | |
691 | ||
d9c85e0f AD |
692 | $auth_login = $this->dbh->escape_string(trim($_POST["auth_login"])); |
693 | $auth_pass = $this->dbh->escape_string(trim($_POST["auth_pass"])); | |
97acbaf1 | 694 | |
a42c55f0 | 695 | $rc = subscribe_to_feed($feed_url, $cat_id, $auth_login, $auth_pass); |
97acbaf1 AD |
696 | |
697 | switch ($rc) { | |
698 | case 1: | |
699 | print_notice(T_sprintf("Subscribed to <b>%s</b>.", $feed_url)); | |
700 | break; | |
701 | case 2: | |
702 | print_error(T_sprintf("Could not subscribe to <b>%s</b>.", $feed_url)); | |
703 | break; | |
704 | case 3: | |
705 | print_error(T_sprintf("No feeds found in <b>%s</b>.", $feed_url)); | |
706 | break; | |
707 | case 0: | |
708 | print_warning(T_sprintf("Already subscribed to <b>%s</b>.", $feed_url)); | |
709 | break; | |
710 | case 4: | |
711 | print_notice(__("Multiple feed URLs found.")); | |
6f7798b6 RL |
712 | $contents = @fetch_file_contents($url, false, $auth_login, $auth_pass); |
713 | if (is_html($contents)) { | |
714 | $feed_urls = get_feeds_from_html($url, $contents); | |
715 | } | |
97acbaf1 AD |
716 | break; |
717 | case 5: | |
718 | print_error(T_sprintf("Could not subscribe to <b>%s</b>.<br>Can't download the Feed URL.", $feed_url)); | |
719 | break; | |
720 | } | |
721 | ||
722 | if ($feed_urls) { | |
723 | print "<form action=\"backend.php\">"; | |
724 | print "<input type=\"hidden\" name=\"op\" value=\"pref-feeds\">"; | |
725 | print "<input type=\"hidden\" name=\"quiet\" value=\"1\">"; | |
726 | print "<input type=\"hidden\" name=\"method\" value=\"add\">"; | |
727 | ||
728 | print "<select name=\"feed_url\">"; | |
729 | ||
730 | foreach ($feed_urls as $url => $name) { | |
731 | $url = htmlspecialchars($url); | |
732 | $name = htmlspecialchars($name); | |
733 | print "<option value=\"$url\">$name</option>"; | |
734 | } | |
735 | ||
736 | print "<input type=\"submit\" value=\"".__("Subscribe to selected feed")."\">"; | |
737 | print "</form>"; | |
738 | } | |
739 | ||
740 | $tp_uri = get_self_url_prefix() . "/prefs.php"; | |
741 | $tt_uri = get_self_url_prefix(); | |
742 | ||
743 | if ($rc <= 2){ | |
d9c85e0f | 744 | $result = $this->dbh->query("SELECT id FROM ttrss_feeds WHERE |
97acbaf1 AD |
745 | feed_url = '$feed_url' AND owner_uid = " . $_SESSION["uid"]); |
746 | ||
d9c85e0f | 747 | $feed_id = $this->dbh->fetch_result($result, 0, "id"); |
97acbaf1 AD |
748 | } else { |
749 | $feed_id = 0; | |
750 | } | |
751 | ||
752 | print "<p>"; | |
753 | ||
754 | if ($feed_id) { | |
755 | print "<form method=\"GET\" style='display: inline' | |
756 | action=\"$tp_uri\"> | |
757 | <input type=\"hidden\" name=\"tab\" value=\"feedConfig\"> | |
758 | <input type=\"hidden\" name=\"method\" value=\"editFeed\"> | |
759 | <input type=\"hidden\" name=\"methodparam\" value=\"$feed_id\"> | |
760 | <input type=\"submit\" value=\"".__("Edit subscription options")."\"> | |
761 | </form>"; | |
762 | } | |
763 | ||
764 | print "<form style='display: inline' method=\"GET\" action=\"$tt_uri\"> | |
765 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
766 | </form></p>"; | |
767 | ||
768 | print "</body></html>"; | |
769 | } | |
770 | ||
771 | function index() { | |
772 | header("Content-Type: text/plain"); | |
773 | print json_encode(array("error" => array("code" => 7))); | |
774 | } | |
775 | ||
f43e9e97 | 776 | function forgotpass() { |
67e0cf9a AD |
777 | startup_gettext(); |
778 | ||
f43e9e97 | 779 | header('Content-Type: text/html; charset=utf-8'); |
d0ee0f52 AD |
780 | print "<html><head><title>Tiny Tiny RSS</title> |
781 | <link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\"> | |
782 | <link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\">"; | |
e216d302 | 783 | |
5bbc4bb4 | 784 | stylesheet_tag("css/utility.css"); |
6f7798b6 | 785 | javascript_tag("lib/prototype.js"); |
e216d302 AD |
786 | |
787 | print "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/> | |
788 | </head><body id='forgotpass'>"; | |
f43e9e97 | 789 | |
884d1650 | 790 | print '<div class="floatingLogo"><img src="images/logo_small.png"></div>'; |
483f15d5 | 791 | print "<h1>".__("Password recovery")."</h1>"; |
884d1650 | 792 | print "<div class='content'>"; |
f43e9e97 AD |
793 | |
794 | @$method = $_POST['method']; | |
795 | ||
796 | if (!$method) { | |
483f15d5 AD |
797 | print_notice(__("You will need to provide valid account name and email. New password will be sent on your email address.")); |
798 | ||
f43e9e97 | 799 | print "<form method='POST' action='public.php'>"; |
f43e9e97 AD |
800 | print "<input type='hidden' name='method' value='do'>"; |
801 | print "<input type='hidden' name='op' value='forgotpass'>"; | |
802 | ||
803 | print "<fieldset>"; | |
804 | print "<label>".__("Login:")."</label>"; | |
805 | print "<input type='text' name='login' value='' required>"; | |
806 | print "</fieldset>"; | |
807 | ||
808 | print "<fieldset>"; | |
809 | print "<label>".__("Email:")."</label>"; | |
810 | print "<input type='email' name='email' value='' required>"; | |
811 | print "</fieldset>"; | |
812 | ||
813 | print "<fieldset>"; | |
814 | print "<label>".__("How much is two plus two:")."</label>"; | |
815 | print "<input type='text' name='test' value='' required>"; | |
816 | print "</fieldset>"; | |
817 | ||
818 | print "<p/>"; | |
819 | print "<button type='submit'>".__("Reset password")."</button>"; | |
820 | ||
821 | print "</form>"; | |
822 | } else if ($method == 'do') { | |
823 | ||
d9c85e0f AD |
824 | $login = $this->dbh->escape_string($_POST["login"]); |
825 | $email = $this->dbh->escape_string($_POST["email"]); | |
826 | $test = $this->dbh->escape_string($_POST["test"]); | |
f43e9e97 AD |
827 | |
828 | if (($test != 4 && $test != 'four') || !$email || !$login) { | |
829 | print_error(__('Some of the required form parameters are missing or incorrect.')); | |
830 | ||
483f15d5 AD |
831 | print "<form method=\"GET\" action=\"public.php\"> |
832 | <input type=\"hidden\" name=\"op\" value=\"forgotpass\"> | |
833 | <input type=\"submit\" value=\"".__("Go back")."\"> | |
834 | </form>"; | |
f43e9e97 | 835 | |
e216d302 | 836 | } else { |
f43e9e97 | 837 | |
d9c85e0f | 838 | $result = $this->dbh->query("SELECT id FROM ttrss_users |
f43e9e97 AD |
839 | WHERE login = '$login' AND email = '$email'"); |
840 | ||
d9c85e0f AD |
841 | if ($this->dbh->num_rows($result) != 0) { |
842 | $id = $this->dbh->fetch_result($result, 0, "id"); | |
f43e9e97 | 843 | |
a42c55f0 | 844 | Pref_Users::resetUserPassword($id, false); |
f43e9e97 | 845 | |
483f15d5 AD |
846 | print "<p>"; |
847 | ||
e216d302 | 848 | print "<p>"."Completed."."</p>"; |
483f15d5 AD |
849 | |
850 | print "<form method=\"GET\" action=\"index.php\"> | |
851 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
852 | </form>"; | |
f43e9e97 AD |
853 | |
854 | } else { | |
855 | print_error(__("Sorry, login and email combination not found.")); | |
483f15d5 AD |
856 | |
857 | print "<form method=\"GET\" action=\"public.php\"> | |
858 | <input type=\"hidden\" name=\"op\" value=\"forgotpass\"> | |
859 | <input type=\"submit\" value=\"".__("Go back")."\"> | |
860 | </form>"; | |
861 | ||
f43e9e97 | 862 | } |
f43e9e97 AD |
863 | } |
864 | ||
865 | } | |
866 | ||
884d1650 | 867 | print "</div>"; |
f43e9e97 AD |
868 | print "</body>"; |
869 | print "</html>"; | |
870 | ||
b4c47f7e AD |
871 | } |
872 | ||
873 | function dbupdate() { | |
67e0cf9a AD |
874 | startup_gettext(); |
875 | ||
f240d26e AD |
876 | if (!SINGLE_USER_MODE && $_SESSION["access_level"] < 10) { |
877 | $_SESSION["login_error_msg"] = __("Your access level is insufficient to run this script."); | |
6322ac79 | 878 | render_login_form(); |
f240d26e AD |
879 | exit; |
880 | } | |
881 | ||
882 | ?><html> | |
883 | <head> | |
884 | <title>Database Updater</title> | |
885 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> | |
5bbc4bb4 | 886 | <link rel="stylesheet" type="text/css" href="css/utility.css"/> |
d0ee0f52 AD |
887 | <link rel=\"shortcut icon\" type=\"image/png\" href=\"images/favicon.png\"> |
888 | <link rel=\"icon\" type=\"image/png\" sizes=\"72x72\" href=\"images/favicon-72px.png\"> | |
f240d26e AD |
889 | </head> |
890 | <style type="text/css"> | |
891 | span.ok { color : #009000; font-weight : bold; } | |
892 | span.err { color : #ff0000; font-weight : bold; } | |
893 | </style> | |
894 | <body> | |
895 | <script type='text/javascript'> | |
896 | function confirmOP() { | |
897 | return confirm("Update the database?"); | |
898 | } | |
899 | </script> | |
900 | ||
901 | <div class="floatingLogo"><img src="images/logo_small.png"></div> | |
902 | ||
903 | <h1><?php echo __("Database Updater") ?></h1> | |
904 | ||
905 | <div class="content"> | |
906 | ||
907 | <?php | |
908 | @$op = $_REQUEST["subop"]; | |
0630a100 | 909 | $updater = new DbUpdater(Db::get(), DB_TYPE, SCHEMA_VERSION); |
f240d26e AD |
910 | |
911 | if ($op == "performupdate") { | |
912 | if ($updater->isUpdateRequired()) { | |
913 | ||
914 | print "<h2>Performing updates</h2>"; | |
915 | ||
916 | print "<h3>Updating to schema version " . SCHEMA_VERSION . "</h3>"; | |
917 | ||
918 | print "<ul>"; | |
919 | ||
920 | for ($i = $updater->getSchemaVersion() + 1; $i <= SCHEMA_VERSION; $i++) { | |
921 | print "<li>Performing update up to version $i..."; | |
922 | ||
923 | $result = $updater->performUpdateTo($i); | |
924 | ||
925 | if (!$result) { | |
926 | print "<span class='err'>FAILED!</span></li></ul>"; | |
927 | ||
928 | print_warning("One of the updates failed. Either retry the process or perform updates manually."); | |
929 | print "<p><form method=\"GET\" action=\"index.php\"> | |
930 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
931 | </form>"; | |
932 | ||
933 | break; | |
934 | } else { | |
935 | print "<span class='ok'>OK!</span></li>"; | |
936 | } | |
937 | } | |
938 | ||
939 | print "</ul>"; | |
b4c47f7e | 940 | |
f240d26e | 941 | print_notice("Your Tiny Tiny RSS database is now updated to the latest version."); |
b4c47f7e | 942 | |
f240d26e AD |
943 | print "<p><form method=\"GET\" action=\"index.php\"> |
944 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
945 | </form>"; | |
946 | ||
947 | } else { | |
948 | print "<h2>Your database is up to date.</h2>"; | |
949 | ||
950 | print "<p><form method=\"GET\" action=\"index.php\"> | |
951 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
952 | </form>"; | |
953 | } | |
954 | } else { | |
955 | if ($updater->isUpdateRequired()) { | |
956 | ||
957 | print "<h2>Database update required</h2>"; | |
b4c47f7e | 958 | |
f240d26e AD |
959 | print "<h3>"; |
960 | printf("Your Tiny Tiny RSS database needs update to the latest version: %d to %d.", | |
961 | $updater->getSchemaVersion(), SCHEMA_VERSION); | |
962 | print "</h3>"; | |
b4c47f7e | 963 | |
f240d26e | 964 | print_warning("Please backup your database before proceeding."); |
b4c47f7e | 965 | |
f240d26e AD |
966 | print "<form method='POST'> |
967 | <input type='hidden' name='subop' value='performupdate'> | |
968 | <input type='submit' onclick='return confirmOP()' value='".__("Perform updates")."'> | |
969 | </form>"; | |
970 | ||
971 | } else { | |
972 | ||
3c200461 | 973 | print_notice("Tiny Tiny RSS database is up to date."); |
f240d26e AD |
974 | |
975 | print "<p><form method=\"GET\" action=\"index.php\"> | |
976 | <input type=\"submit\" value=\"".__("Return to Tiny Tiny RSS")."\"> | |
977 | </form>"; | |
978 | ||
979 | } | |
980 | } | |
981 | ?> | |
b4c47f7e | 982 | |
f240d26e AD |
983 | </div> |
984 | </body> | |
985 | </html> | |
986 | <?php | |
f43e9e97 AD |
987 | } |
988 | ||
5f0a3741 AD |
989 | } |
990 | ?> |