<?php
+ set_include_path(get_include_path() . PATH_SEPARATOR . "include");
+
/* remove ill effects of magic quotes */
if (get_magic_quotes_gpc()) {
$_REQUEST = array_map('stripslashes_deep', $_REQUEST);
}
+ function __autoload($class) {
+ $file = "classes/".strtolower(basename($class)).".php";
+ if (file_exists($file)) {
+ require $file;
+ }
+ }
+
$op = $_REQUEST["op"];
require_once "functions.php";
if ($op != "share") require_once "sessions.php";
- require_once "modules/backend-rpc.php";
require_once "sanity_check.php";
require_once "config.php";
require_once "db.php";
init_connection($link);
- $subop = $_REQUEST["subop"];
+ $method = strtolower($_REQUEST["method"]);
$mode = $_REQUEST["mode"];
if ((!$op || $op == "rss" || $op == "dlg") && !$_REQUEST["noxml"]) {
return;
} else if (!($_SESSION["uid"] && validate_session($link))) {
- if ($op == 'pref-feeds' && $_REQUEST['subop'] == 'add') {
+ if ($op == 'pref-feeds' && $_REQUEST['method'] == 'add') {
header("Content-Type: text/html");
login_sequence($link);
render_login_form($link);
5 => __("Power User"),
10 => __("Administrator"));
-
+
$error = sanity_check($link);
return;
}
- switch($op) { // Select action according to $op value.
- case "rpc":
- // Handle remote procedure calls.
- handle_rpc_request($link);
- break; // rpc
+ if (class_exists($op)) {
+ $handler = new $op($link, $_REQUEST);
+ if ($handler) {
+ if ($handler->before()) {
+ if (method_exists($handler, $method)) {
+ return $handler->$method();
+ }
+ }
+ }
+ }
+
+ switch($op) { // Select action according to $op value.
case "feeds":
- $subop = $_REQUEST["subop"];
+ $method = $_REQUEST["method"];
$root = (bool)$_REQUEST["root"];
- switch($subop) {
+ switch($method) {
case "catchupAll":
db_query($link, "UPDATE ttrss_user_entries SET
last_read = NOW(),unread = false WHERE owner_uid = " . $_SESSION["uid"]);
$omode = db_escape_string($_REQUEST["omode"]);
$feed = db_escape_string($_REQUEST["feed"]);
- $subop = db_escape_string($_REQUEST["subop"]);
+ $method = db_escape_string($_REQUEST["method"]);
$view_mode = db_escape_string($_REQUEST["view_mode"]);
$limit = (int) get_pref($link, "DEFAULT_ARTICLE_LIMIT");
@$cat_view = db_escape_string($_REQUEST["cat"]) == "true";
if ($_REQUEST["debug"]) $timing_info = print_checkpoint("04", $timing_info);
- $ret = format_headlines_list($link, $feed, $subop,
+ $ret = format_headlines_list($link, $feed, $method,
$view_mode, $limit, $cat_view, $next_unread_feed, $offset,
$vgroup_last_feed, $override_order);
$reply['articles'] = $articles;
}
-// if ($subop) {
+// if ($method) {
// $reply['counters'] = getAllCounters($link, $omode, $feed);
// }
$reply['runtime-info'] = make_runtime_info($link);
print json_encode($reply);
-
break; // viewfeed
case "pref-feeds":