summaryrefslogtreecommitdiff
path: root/api
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2009-12-16 14:36:59 +0300
committerAndrew Dolgov <[email protected]>2009-12-16 14:36:59 +0300
commit3a216db45c510f2601fcdb3b879e2e20dce63dd5 (patch)
tree8a96ee0ee0ad9755020e58da5b1a20e03b360ce0 /api
parentf5a5bae4633272d2adbdcdffb57db23df108c3e7 (diff)
add per-user option to enable access to API
Diffstat (limited to 'api')
-rw-r--r--api/index.php7
1 files changed, 3 insertions, 4 deletions
diff --git a/api/index.php b/api/index.php
index ff8c70f58..90ca5405c 100644
--- a/api/index.php
+++ b/api/index.php
@@ -44,11 +44,10 @@
return;
}
-/* TODO: add pref key to disable/enable API
- if ($_SESSION["uid"] && !get_pref($link, 'API_ENABLED')) {
+ if ($_SESSION["uid"] && $op != "logout" && !get_pref($link, 'ENABLE_API_ACCESS')) {
print json_encode(array("error" => 'API_DISABLED'));
return;
- } */
+ }
switch ($op) {
case "getVersion":
@@ -62,7 +61,7 @@
if (authenticate_user($link, $login, $password)) {
print json_encode(array("uid" => $_SESSION["uid"]));
} else {
- print json_encode(array("uid" => 0));
+ print json_encode(array("error" => "LOGIN_ERROR"));
}
break;