aboutsummaryrefslogtreecommitdiffstats
path: root/mod/dirsearch.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-09-05 22:00:06 -0700
committerfriendica <info@friendica.com>2013-09-05 22:00:06 -0700
commitc65ea0b97b2dc6fcefa0d2da489f32bdd7d05b65 (patch)
tree6b1e2faaa0a85aa9216d674ebecd48e0df049cd3 /mod/dirsearch.php
parentf8801185588a058a26c7aabd6be22ec27ee91b38 (diff)
downloadvolse-hubzilla-c65ea0b97b2dc6fcefa0d2da489f32bdd7d05b65.tar.gz
volse-hubzilla-c65ea0b97b2dc6fcefa0d2da489f32bdd7d05b65.tar.bz2
volse-hubzilla-c65ea0b97b2dc6fcefa0d2da489f32bdd7d05b65.zip
public site list (will take a few days to populate, assuming folks have updated their site access policy which old sites do not have)
Diffstat (limited to 'mod/dirsearch.php')
-rw-r--r--mod/dirsearch.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 524f55cc1..7bf430bec 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -22,6 +22,12 @@ function dirsearch_content(&$a) {
json_return_and_die($ret);
}
+ if(argc > 1 && argv(1) === 'sites') {
+ $ret = list_public_sites();
+ json_return_and_die($ret);
+ }
+
+
$name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : '');
$hub = ((x($_REQUEST,'hub')) ? $_REQUEST['hub'] : '');
$address = ((x($_REQUEST,'address')) ? $_REQUEST['address'] : '');
@@ -163,3 +169,33 @@ function dirsearch_content(&$a) {
json_return_and_die($ret);
}
+
+
+function list_public_sites() {
+ $r = q("select * from site where site_access != 0 order by rand()");
+ $ret = array('success' => false);
+
+ if($r) {
+ $ret['success'] = true;
+ $ret['sites'] = array();
+ foreach($r as $rr) {
+
+ if($rr['site_access'] == ACCESS_FREE)
+ $access = 'free';
+ elseif($rr['site_access'] == ACCESS_PAID)
+ $access = 'paid';
+ else
+ $access = 'private';
+
+ if($rr['site_register'] == REGISTER_OPEN)
+ $register = 'open';
+ elseif($rr['site_register'] == REGISTER_APPROVE)
+ $register = 'approve';
+ else
+ $register = 'closed';
+
+ $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register);
+ }
+ }
+ return $ret;
+} \ No newline at end of file