]> git.mxchange.org Git - friendica.git/blobdiff - mod/poco.php
Merge remote-tracking branch 'upstream/develop' into 1702-detect-server
[friendica.git] / mod / poco.php
index a97ca64e3352c8076cb6d778e918252aa3efd032..422bfe5b7c88e0957b3842c54840fefb869d2fa0 100644 (file)
@@ -2,7 +2,7 @@
 // See here for a documentation for portable contacts:
 // https://web.archive.org/web/20160405005550/http://portablecontacts.net/draft-spec.html
 
-function poco_init(&$a) {
+function poco_init(App $a) {
        require_once("include/bbcode.php");
 
        $system_mode = false;
@@ -16,8 +16,9 @@ function poco_init(&$a) {
        }
        if(! x($user)) {
                $c = q("SELECT * FROM `pconfig` WHERE `cat` = 'system' AND `k` = 'suggestme' AND `v` = 1");
-               if(! count($c))
+               if (! dbm::is_result($c)) {
                        http_status_exit(401);
+               }
                $system_mode = true;
        }
 
@@ -26,6 +27,12 @@ function poco_init(&$a) {
        $justme = false;
        $global = false;
 
+       if($a->argc > 1 && $a->argv[1] === '@server') {
+               $ret = poco_serverlist();
+               header('Content-type: application/json');
+               echo json_encode($ret);
+               killme();
+       }
        if($a->argc > 1 && $a->argv[1] === '@global') {
                $global = true;
                $update_limit = date("Y-m-d H:i:s", time() - 30 * 86400);
@@ -313,11 +320,9 @@ function poco_init(&$a) {
 
                                $ret['entry'][] = $entry;
                        }
-               }
-               else
+               } else
                        $ret['entry'][] = array();
-       }
-       else
+       } else
                http_status_exit(500);
 
        logger("End of poco", LOGGER_DEBUG);
@@ -331,8 +336,7 @@ function poco_init(&$a) {
                header('Content-type: application/json');
                echo json_encode($ret);
                killme();
-       }
-       else
+       } else
                http_status_exit(500);