From 2035a5dd763f7524cdc1a678b0e8dbca94f270f5 Mon Sep 17 00:00:00 2001 From: friendica Date: Wed, 30 Oct 2013 01:58:45 -0700 Subject: allow zot public providers to list their location, as a non US-based server could be a strong selling point. --- boot.php | 2 +- include/zot.php | 10 +++++++--- install/database.sql | 1 + install/update.php | 9 ++++++++- mod/dirsearch.php | 2 +- mod/pubsites.php | 7 +++++-- mod/zfinger.php | 1 + 7 files changed, 24 insertions(+), 8 deletions(-) diff --git a/boot.php b/boot.php index 709877472..c7af5147e 100755 --- a/boot.php +++ b/boot.php @@ -45,7 +45,7 @@ define ( 'RED_PLATFORM', 'Red Matrix' ); define ( 'RED_VERSION', trim(file_get_contents('version.inc')) . 'R'); define ( 'ZOT_REVISION', 1 ); -define ( 'DB_UPDATE_VERSION', 1079 ); +define ( 'DB_UPDATE_VERSION', 1080 ); define ( 'EOL', '
' . "\r\n" ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); diff --git a/include/zot.php b/include/zot.php index ae34beebc..c4dce5ceb 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1640,20 +1640,23 @@ function import_site($arr,$pubkey) { $directory_url = htmlentities($arr['directory_url'],ENT_COMPAT,'UTF-8',false); $url = htmlentities($arr['url'],ENT_COMPAT,'UTF-8',false); $sellpage = htmlentities($arr['sellpage'],ENT_COMPAT,'UTF-8',false); + $site_location = htmlentities($arr['location'],ENT_COMPAT,'UTF-8',false); if($exists) { if(($siterecord['site_flags'] != $site_directory) || ($siterecord['site_access'] != $access_policy) || ($siterecord['site_directory'] != $directory_url) || ($siterecord['site_sellpage'] != $sellpage) + || ($siterecord['site_location'] != $site_location) || ($siterecord['site_register'] != $register_policy)) { $update = true; // logger('import_site: input: ' . print_r($arr,true)); // logger('import_site: stored: ' . print_r($siterecord,true)); - $r = q("update site set site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s' + $r = q("update site set site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s' where site_url = '%s' limit 1", + dbesc($site_location), intval($site_directory), intval($access_policy), dbesc($directory_url), @@ -1669,8 +1672,9 @@ function import_site($arr,$pubkey) { } else { $update = true; - $r = q("insert into site ( site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage ) - values ( '%s', %d, %d, '%s', '%s', %d, '%s' )", + $r = q("insert into site ( site_location, site_url, site_access, site_flags, site_update, site_directory, site_register, site_sellpage ) + values ( '%s', '%s', %d, %d, '%s', '%s', %d, '%s' )", + dbesc($site_location), dbesc($url), intval($access_policy), intval($site_directory), diff --git a/install/database.sql b/install/database.sql index b482c3376..879c7f132 100644 --- a/install/database.sql +++ b/install/database.sql @@ -832,6 +832,7 @@ CREATE TABLE IF NOT EXISTS `site` ( `site_directory` char(255) NOT NULL DEFAULT '', `site_register` int(11) NOT NULL DEFAULT '0', `site_sellpage` char(255) NOT NULL DEFAULT '', + `site_location` char(255 NOT NULL DEFAULT '', PRIMARY KEY (`site_url`), KEY `site_access` (`site_access`), KEY `site_flags` (`site_flags`), diff --git a/install/update.php b/install/update.php index 07a773f68..53d487f91 100644 --- a/install/update.php +++ b/install/update.php @@ -1,6 +1,6 @@ $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage']); + $ret['sites'][] = array('url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location']); } } return $ret; diff --git a/mod/pubsites.php b/mod/pubsites.php index 9728d0704..78b107229 100644 --- a/mod/pubsites.php +++ b/mod/pubsites.php @@ -21,13 +21,16 @@ function pubsites_content(&$a) { $o .= '

' . t('Public Sites') . '

'; + $o .= '
' . + t('The listed sites allow public registration. Some may require subscription or provide tiered service plans. The provider links may provide additional details.') . '
' . EOL; + $ret = z_fetch_url($url); if($ret['success']) { $j = json_decode($ret['body'],true); if($j) { - $o .= ''; + $o .= '
' . t('Site URL') . '' . t('Access Type') . '' . t('Registration Policy') . '
'; foreach($j['sites'] as $jj) { - $o .= ''; + $o .= ''; } $o .= '
' . t('Site URL') . '' . t('Access Type') . '' . t('Registration Policy') . '' . t('Location') . '
' . '' . $jj['url'] . '' . '' . $jj['access'] . '' . $jj['register'] . '
' . '' . $jj['url'] . '' . '' . $jj['access'] . '' . $jj['register'] . '' . $jj['location'] . '
'; diff --git a/mod/zfinger.php b/mod/zfinger.php index 3671da56e..59cef5549 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -248,6 +248,7 @@ function zfinger_init(&$a) { $ret['site']['sitehash'] = get_config('system','location_hash'); $ret['site']['sitename'] = get_config('system','sitename'); $ret['site']['sellpage'] = get_config('system','sellpage'); + $ret['site']['location'] = get_config('system','site_location'); } json_return_and_die($ret); -- cgit v1.2.3