api: always chdir() to base directory (refs #375)

This commit is contained in:
Andrew Dolgov 2011-11-07 10:21:18 +04:00
parent 823da71a10
commit 8ad4bac0fd

View file

@ -10,6 +10,8 @@
define('API_STATUS_OK', 0); define('API_STATUS_OK', 0);
define('API_STATUS_ERR', 1); define('API_STATUS_ERR', 1);
chdir("..");
if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT) { if (defined('ENABLE_GZIP_OUTPUT') && ENABLE_GZIP_OUTPUT) {
ob_start("ob_gzhandler"); ob_start("ob_gzhandler");
} }
@ -154,8 +156,6 @@
$limit = (int) db_escape_string($_REQUEST["limit"]); $limit = (int) db_escape_string($_REQUEST["limit"]);
$offset = (int) db_escape_string($_REQUEST["offset"]); $offset = (int) db_escape_string($_REQUEST["offset"]);
chdir(".."); // so feed_has_icon() would work properly for relative ICONS_DIR
$feeds = api_get_feeds($link, $cat_id, $unread_only, $limit, $offset); $feeds = api_get_feeds($link, $cat_id, $unread_only, $limit, $offset);
print api_wrap_reply(API_STATUS_OK, $seq, $feeds); print api_wrap_reply(API_STATUS_OK, $seq, $feeds);