aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-08-06 17:15:41 -0700
committerfriendica <info@friendica.com>2013-08-06 17:15:41 -0700
commit99bd0712b6170b337de6d1c31db7c66ad8a18767 (patch)
tree88c84722833fa1deeea20efc4e1cac3e2f49a0bc
parent687ea0ca249b20f790be2dcedc1ca8d60a76135d (diff)
downloadvolse-hubzilla-99bd0712b6170b337de6d1c31db7c66ad8a18767.tar.gz
volse-hubzilla-99bd0712b6170b337de6d1c31db7c66ad8a18767.tar.bz2
volse-hubzilla-99bd0712b6170b337de6d1c31db7c66ad8a18767.zip
Add a site access policy (to determine if this is really a public site or just an open site) and add an orphan flag to xchans in case all their hublocs go away. Get rid of a couple of DO NOT EDIT template messages which were still lurking in the tree.
-rwxr-xr-xboot.php11
-rw-r--r--mod/dirsearch.php10
-rw-r--r--mod/zfinger.php10
-rw-r--r--view/en/htconfig.tpl14
-rw-r--r--view/ru/strings.php2
-rwxr-xr-xview/tpl/admin_plugins.tpl5
-rwxr-xr-xview/tpl/api_user_xml.tpl5
7 files changed, 42 insertions, 15 deletions
diff --git a/boot.php b/boot.php
index de1c640a6..4868046c6 100755
--- a/boot.php
+++ b/boot.php
@@ -140,6 +140,16 @@ define ( 'REGISTER_CLOSED', 0 );
define ( 'REGISTER_APPROVE', 1 );
define ( 'REGISTER_OPEN', 2 );
+
+/**
+ * site access policy
+ */
+
+define ( 'ACCESS_PRIVATE', 0 );
+define ( 'ACCESS_PAID', 1 );
+define ( 'ACCESS_FREE', 2 );
+
+
/**
* relationship types
*/
@@ -322,6 +332,7 @@ define ( 'HUBLOC_FLAGS_UNVERIFIED', 0x0002);
define ( 'XCHAN_FLAGS_HIDDEN', 0x0001);
+define ( 'XCHAN_FLAGS_ORPHAN', 0x0002);
/**
diff --git a/mod/dirsearch.php b/mod/dirsearch.php
index 6d6ef7434..524f55cc1 100644
--- a/mod/dirsearch.php
+++ b/mod/dirsearch.php
@@ -95,8 +95,9 @@ function dirsearch_content(&$a) {
else {
$qlimit = " LIMIT " . intval($startrec) . " , " . intval($perpage);
if($return_total) {
- $r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d) ",
- intval(XCHAN_FLAGS_HIDDEN)
+ $r = q("SELECT COUNT(xchan_hash) AS `total` FROM xchan left join xprof on xchan_hash = xprof_hash where $logic $sql_extra and not ( xchan_flags & %d) and not ( xchan_flags & %d ) ",
+ intval(XCHAN_FLAGS_HIDDEN),
+ intval(XCHAN_FLAGS_ORPHAN)
);
if($r) {
$ret['total_items'] = $r[0]['total'];
@@ -118,8 +119,9 @@ function dirsearch_content(&$a) {
- $r = q("SELECT xchan.*, xprof.*, updates.* from xchan left join xprof on xchan_hash = xprof_hash left join updates on xchan_hash = ud_hash where $logic $sql_extra and not ( xchan_flags & %d ) $order $qlimit ",
- intval(XCHAN_FLAGS_HIDDEN)
+ $r = q("SELECT xchan.*, xprof.*, updates.* from xchan left join xprof on xchan_hash = xprof_hash left join updates on xchan_hash = ud_hash where $logic $sql_extra and not ( xchan_flags & %d ) and not ( xchan_flags & %d ) $order $qlimit ",
+ intval(XCHAN_FLAGS_HIDDEN),
+ intval(XCHAN_FLAGS_ORPHAN)
);
$ret['page'] = $page + 1;
diff --git a/mod/zfinger.php b/mod/zfinger.php
index a3da62162..cf61233ad 100644
--- a/mod/zfinger.php
+++ b/mod/zfinger.php
@@ -202,6 +202,16 @@ function zfinger_init(&$a) {
if($register_policy == REGISTER_OPEN)
$ret['site']['register_policy'] = 'open';
+
+ $access_policy = intval(get_config('system','access_policy'));
+
+ if($access_policy == ACCESS_PRIVATE)
+ $ret['site']['access_policy'] = 'private';
+ if($access_policy == ACCESS_PAID)
+ $ret['site']['access_policy'] = 'paid';
+ if($access_policy == ACCESS_FREE)
+ $ret['site']['access_policy'] = 'free';
+
require_once('include/account.php');
$ret['site']['accounts'] = account_total();
diff --git a/view/en/htconfig.tpl b/view/en/htconfig.tpl
index 493cb5d00..0417e9af2 100644
--- a/view/en/htconfig.tpl
+++ b/view/en/htconfig.tpl
@@ -33,6 +33,7 @@ $a->config['system']['baseurl'] = '{{$siteurl}}';
$a->config['system']['sitename'] = "Red Matrix";
$a->config['system']['location_hash'] = '{{$site_id}}';
+
// Your choices are REGISTER_OPEN, REGISTER_APPROVE, or REGISTER_CLOSED.
// Be certain to create your own personal account before setting
// REGISTER_CLOSED. 'register_text' (if set) will be displayed prominently on
@@ -44,6 +45,19 @@ $a->config['system']['register_policy'] = REGISTER_OPEN;
$a->config['system']['register_text'] = '';
$a->config['system']['admin_email'] = '{{$adminmail}}';
+
+// Site access restrictions. By default we will create private sites.
+// Your choices are ACCESS_PRIVATE, ACCESS_PAID, and ACCESS_FREE.
+// If you leave REGISTER_OPEN above, anybody may register on your
+// site, however your site will not be listed anywhere as an open
+// registration hub. We will use the system access policy (below)
+// to determine whether or not to list your site in the directory
+// as an open hub where anybody may create accounts. Your choice of
+// paid or free determines how these listings will be presented.
+
+$a->config['system']['access_policy'] = ACCESS_PRIVATE;
+
+
// Maximum size of an imported message, 0 is unlimited
$a->config['system']['max_import_size'] = 200000;
diff --git a/view/ru/strings.php b/view/ru/strings.php
index 90e08ca4a..03d38589a 100644
--- a/view/ru/strings.php
+++ b/view/ru/strings.php
@@ -1172,7 +1172,7 @@ $a->strings["Connections: settings for %s"] = "";
$a->strings["When receiving a channel introduction, any permissions provided here will be applied to the new connection automatically and the introduction approved. Leave this page if you do not wish to use this feature."] = "";
$a->strings["Slide to adjust your degree of friendship"] = "";
$a->strings["Connection has no individual permissions!"] = "";
-$a->strings["This may be appropriate based on your <a href=\"settings\">privacy settings</a>, though you may wish to review the \"Advanced Permissions\"] = "";
+$a->strings["This may be appropriate based on your <a href=\"settings\">privacy settings</a>, though you may wish to review the \"Advanced Permissions\""] = "";
$a->strings["Profile Visibility"] = "";
$a->strings["Please choose the profile you would like to display to %s when viewing your profile securely."] = "";
$a->strings["Contact Information / Notes"] = "";
diff --git a/view/tpl/admin_plugins.tpl b/view/tpl/admin_plugins.tpl
index 307814e87..01c178c3e 100755
--- a/view/tpl/admin_plugins.tpl
+++ b/view/tpl/admin_plugins.tpl
@@ -1,8 +1,3 @@
-{{*
- * AUTOMATICALLY GENERATED TEMPLATE
- * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
- *
- *}}
<div id='adminpage'>
<h1>{{$title}} - {{$page}}</h1>
diff --git a/view/tpl/api_user_xml.tpl b/view/tpl/api_user_xml.tpl
index d7efcf3fb..3b51992f6 100755
--- a/view/tpl/api_user_xml.tpl
+++ b/view/tpl/api_user_xml.tpl
@@ -1,8 +1,3 @@
-{{*
- * AUTOMATICALLY GENERATED TEMPLATE
- * DO NOT EDIT THIS FILE, CHANGES WILL BE OVERWRITTEN
- *
- *}}
<user>
<id>{{$user.id}}</id>
<name>{{$user.name}}</name>