Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2020-09-02 23:14:47 -07:00
commit 0cbb5919b9
7 changed files with 81 additions and 79 deletions

View file

@ -2,6 +2,7 @@
namespace Zotlabs\Daemon;
use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Libzot;
class Cron_daily {
@ -14,7 +15,10 @@ class Cron_daily {
*
*/
// Libzotdir::check_upstream_directory();
// make sure our own site record is up to date
Libzot::import_site(Libzot::site_info(true));
// Fire off the Cron_weekly process if it's the correct day.

View file

@ -3190,7 +3190,7 @@ class Libzot {
}
static function site_info() {
static function site_info($force = false) {
$signing_key = get_config('system','prvkey');
$sig_method = get_config('system','signature_algorithm','sha256');
@ -3228,7 +3228,7 @@ class Libzot {
// hide detailed site information if you're off the grid
if ($dirmode != DIRECTORY_MODE_STANDALONE) {
if ($dirmode != DIRECTORY_MODE_STANDALONE || $force) {
$register_policy = intval(get_config('system','register_policy'));
@ -3257,10 +3257,6 @@ class Libzot {
$ret['site']['access_policy'] = 'tiered';
}
$ret['site']['accounts'] = account_total();
$ret['site']['channels'] = channel_total();
$ret['site']['admin'] = get_config('system','admin_email');
$visible_plugins = [];

View file

@ -91,9 +91,9 @@ class Directory extends Controller {
$globaldir = Libzotdir::get_directory_setting($observer, 'globaldir');
// override your personal global search pref if we're doing a navbar search of the directory
// if (intval($_REQUEST['navsearch'])) {
// $globaldir = 1;
// }
if (intval($_REQUEST['navsearch'])) {
$globaldir = 1;
}
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode');
@ -130,7 +130,8 @@ class Directory extends Controller {
// only works if the suggestion query and the directory query have the
// same number of results
$r = suggestion_query(local_channel(),get_observer_hash(),0,DIRECTORY_PAGESIZE);
App::set_pager_itemspage(60);
$r = suggestion_query(local_channel(),get_observer_hash(),App::$pager['start'],DIRECTORY_PAGESIZE);
if (! $r) {
notice( t('No default suggestions were found.') . EOL);
@ -162,23 +163,10 @@ class Directory extends Controller {
$directory_admin = false;
// if (($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
$url = z_root() . '/dirsearch';
if (is_site_admin()) {
$directory_admin = true;
}
// }
// if (! $url) {
// $directory = Libzotdir::find_upstream_directory($dirmode);
// if ((! $directory) || (! array_key_exists('url',$directory)) || (! $directory['url'])) {
// logger('CRITICAL: No directory server URL');
// }
// $url = $directory['url'] . '/dirsearch';
// }
// $token = get_config('system','realm_token');
logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
$url = z_root() . '/dirsearch';
if (is_site_admin()) {
$directory_admin = true;
}
$contacts = array();
@ -305,14 +293,7 @@ class Directory extends Controller {
$page_type = '';
$rating_enabled = get_config('system','rating_enabled');
if ($rr['total_ratings'] && $rating_enabled) {
$total_ratings = sprintf( tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
}
else {
$total_ratings = '';
}
$total_ratings = '';
$profile = $rr;

View file

@ -181,7 +181,7 @@ class Dirsearch extends Controller {
// If &limit=n, return at most n entries
// If &return_total=1, we count matching entries and return that as 'total_items' for use in pagination.
// By default we return one page (default 80 items maximum) and do not count total entries
// By default we return one page (default 60 items maximum) and do not count total entries
$logic = ((strlen($sql_extra)) ? 'false' : 'true');

View file

@ -7,8 +7,6 @@ class Sites extends \Zotlabs\Web\Controller {
function get() {
$url = z_root() . '/dirsearch/sites';
$o .= '<div class="generic-content-wrapper">';
$o .= '<div class="section-title-wrapper"><h2>' . t('Affiliated Sites') . '</h2></div>';
@ -16,49 +14,70 @@ class Sites extends \Zotlabs\Web\Controller {
$o .= '<div class="section-content-tools-wrapper"><div class="descriptive-text">' .
t('This page provides information about related projects and websites that are currently known to this system. These are a small fraction of the thousands of affiliated fediverse websites.') . '</div>' . EOL;
$ret = z_fetch_url($url);
if ($ret['success']) {
$j = json_decode($ret['body'],true);
if ($j) {
if ($j['sites']) {
$projects = $this->sort_sites($j['sites']);
foreach ($projects as $p => $v) {
if (! $p) {
continue;
}
$o .= '<strong>' . ucfirst($p) . '</strong>' . EOL;
$o .= '<table class="table table-striped table-hover"><tr><td style="width: 50%;">' . t('URL') . '</td><td style="width: 15%;">' . t('Access Type') . '</td><td style="width: 15%;">' . t('Registration Policy') . '</td><td style="width: 20%">' . t('Software') . '</td>';
$o .= '</tr>';
usort($v, [ $this, 'sort_versions' ]);
foreach ($v as $jj) {
if (strpos($jj['version'],' ')) {
$x = explode(' ', $jj['version']);
if ($x[1]) {
$jj['version'] = $x[1];
}
}
$m = parse_url($jj['url']);
$host = strtolower($m['host']);
$location = '<br>&nbsp;';
if (!empty($jj['location'])) {
$location = '<br><span title="' . t('Location') . '" style="margin: 5px 5px 0 0; text-align: right"><i class="fa fa-globe"></i> ' . $jj['location'] . '</span>';
}
$disabled = (($jj['access'] === 'private') ? true : false);
$o .= '<tr><td>' . (($disabled) ? '' : '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ') . $host . (($disabled) ? '' : '</a>') . $location . '</td><td>' . $jj['access'] . '</td><td>' . (($disabled) ? '&nbsp;' : $jj['register']) . '</td><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>';
$o .= '</tr>';
}
$o .= '</table>';
$o .= '<br><br>';
}
}
$o .= '</div></div>';
$j = [];
$r = q("select * from site where site_type = %d and site_flags != 256 and site_dead = 0",
intval(SITE_TYPE_ZOT)
);
if ($r) {
foreach ($r as $rr) {
if ($rr['site_access'] == ACCESS_FREE)
$access = 'free';
elseif ($rr['site_access'] == ACCESS_PAID)
$access = 'paid';
elseif ($rr['site_access'] == ACCESS_TIERED)
$access = 'tiered';
else
$access = 'private';
if ($rr['site_register'] == REGISTER_OPEN)
$register = 'open';
elseif ($rr['site_register'] == REGISTER_APPROVE)
$register = 'approve';
else
$register = 'closed';
$j[] = [ 'url' => $rr['site_url'], 'access' => $access, 'register' => $register, 'sellpage' => $rr['site_sellpage'], 'location' => $rr['site_location'], 'project' => $rr['site_project'], 'version' => $rr['site_version'] ];
}
}
return $o;
if ($j) {
$projects = $this->sort_sites($j);
foreach ($projects as $p => $v) {
if (! $p) {
continue;
}
$o .= '<strong>' . ucfirst($p) . '</strong>' . EOL;
$o .= '<table class="table table-striped table-hover"><tr><td style="width: 50%;">' . t('URL') . '</td><td style="width: 15%;">' . t('Access Type') . '</td><td style="width: 15%;">' . t('Registration Policy') . '</td><td style="width: 20%">' . t('Software') . '</td>';
$o .= '</tr>';
usort($v, [ $this, 'sort_versions' ]);
foreach ($v as $jj) {
if (strpos($jj['version'],' ')) {
$x = explode(' ', $jj['version']);
if ($x[1]) {
$jj['version'] = $x[1];
}
}
$m = parse_url($jj['url']);
$host = strtolower($m['host']);
$location = '<br>&nbsp;';
if (!empty($jj['location'])) {
$location = '<br><span title="' . t('Location') . '" style="margin: 5px 5px 0 0; text-align: right"><i class="fa fa-globe"></i> ' . $jj['location'] . '</span>';
}
$disabled = (($jj['access'] === 'private') ? true : false);
$o .= '<tr><td>' . (($disabled) ? '' : '<a href="'. (($jj['sellpage']) ? $jj['sellpage'] : $jj['url'] . '/register' ) . '" ><i class="fa fa-link"></i> ') . $host . (($disabled) ? '' : '</a>') . $location . '</td><td>' . $jj['access'] . '</td><td>' . (($disabled) ? '&nbsp;' : $jj['register']) . '</td><td>' . ucwords($jj['project']) . (($jj['version']) ? ' ' . $jj['version'] : '') . '</td>';
$o .= '</tr>';
}
$o .= '</table>';
$o .= '<br><br>';
}
}
$o .= '</div></div>';
return $o;
}
function sort_sites($a) {

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class.
*/
define ( 'STD_VERSION', '20.09.01' );
define ( 'STD_VERSION', '20.09.03' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1242 );

View file

@ -1769,3 +1769,5 @@ function get_request_string($url) {
return '/' . ((count($a) > 3) ? $a[3] : EMPTY_STR);
}