]> git.wh0rd.org - tt-rss.git/blobdiff - api/index.php
add af_elreg
[tt-rss.git] / api / index.php
index 823b9527e90319645c98d58e387420b906c514d9..facdf82c54db587e9cd07f6cb826b6daec494555 100644 (file)
@@ -13,6 +13,7 @@
        define('TTRSS_SESSION_NAME', 'ttrss_api_sid');
        define('NO_SESSION_AUTOSTART', true);
 
+       require_once "autoload.php";
        require_once "db.php";
        require_once "db-prefs.php";
        require_once "functions.php";
@@ -30,8 +31,6 @@
                ob_start();
        }
 
-       $link = db_connect(DB_HOST, DB_USER, DB_PASS, DB_NAME);
-
        $input = file_get_contents("php://input");
 
        if (defined('_API_DEBUG_HTTP_ENABLED') && _API_DEBUG_HTTP_ENABLED) {
                @session_start();
        }
 
-       if (!init_plugins($link)) return;
+       if (!init_plugins()) return;
 
        $method = strtolower($_REQUEST["op"]);
 
-       $handler = new API($link, $_REQUEST);
+       $handler = new API($_REQUEST);
 
        if ($handler->before($method)) {
                if ($method && method_exists($handler, $method)) {
@@ -69,8 +68,6 @@
                $handler->after();
        }
 
-       db_close($link);
-
        header("Api-Content-Length: " . ob_get_length());
 
        ob_end_flush();