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