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; namespace Zotlabs\Daemon;
use Zotlabs\Lib\Libzotdir; use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Libzot;
class Cron_daily { 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. // 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'); $signing_key = get_config('system','prvkey');
$sig_method = get_config('system','signature_algorithm','sha256'); $sig_method = get_config('system','signature_algorithm','sha256');
@ -3228,7 +3228,7 @@ class Libzot {
// hide detailed site information if you're off the grid // 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')); $register_policy = intval(get_config('system','register_policy'));
@ -3257,10 +3257,6 @@ class Libzot {
$ret['site']['access_policy'] = 'tiered'; $ret['site']['access_policy'] = 'tiered';
} }
$ret['site']['accounts'] = account_total();
$ret['site']['channels'] = channel_total();
$ret['site']['admin'] = get_config('system','admin_email'); $ret['site']['admin'] = get_config('system','admin_email');
$visible_plugins = []; $visible_plugins = [];

View file

@ -91,9 +91,9 @@ class Directory extends Controller {
$globaldir = Libzotdir::get_directory_setting($observer, 'globaldir'); $globaldir = Libzotdir::get_directory_setting($observer, 'globaldir');
// override your personal global search pref if we're doing a navbar search of the directory // override your personal global search pref if we're doing a navbar search of the directory
// if (intval($_REQUEST['navsearch'])) { if (intval($_REQUEST['navsearch'])) {
// $globaldir = 1; $globaldir = 1;
// } }
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode'); $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 // only works if the suggestion query and the directory query have the
// same number of results // 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) { if (! $r) {
notice( t('No default suggestions were found.') . EOL); notice( t('No default suggestions were found.') . EOL);
@ -162,23 +163,10 @@ class Directory extends Controller {
$directory_admin = false; $directory_admin = false;
// if (($dirmode == DIRECTORY_MODE_PRIMARY) || ($dirmode == DIRECTORY_MODE_STANDALONE)) {
$url = z_root() . '/dirsearch'; $url = z_root() . '/dirsearch';
if (is_site_admin()) { if (is_site_admin()) {
$directory_admin = true; $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);
$contacts = array(); $contacts = array();
@ -305,14 +293,7 @@ class Directory extends Controller {
$page_type = ''; $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; $profile = $rr;

View file

@ -181,7 +181,7 @@ class Dirsearch extends Controller {
// If &limit=n, return at most n entries // 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. // 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'); $logic = ((strlen($sql_extra)) ? 'false' : 'true');

View file

@ -7,8 +7,6 @@ class Sites extends \Zotlabs\Web\Controller {
function get() { function get() {
$url = z_root() . '/dirsearch/sites';
$o .= '<div class="generic-content-wrapper">'; $o .= '<div class="generic-content-wrapper">';
$o .= '<div class="section-title-wrapper"><h2>' . t('Affiliated Sites') . '</h2></div>'; $o .= '<div class="section-title-wrapper"><h2>' . t('Affiliated Sites') . '</h2></div>';
@ -17,12 +15,36 @@ class Sites extends \Zotlabs\Web\Controller {
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; 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); $j = [];
if ($ret['success']) {
$j = json_decode($ret['body'],true); $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'] ];
}
}
if ($j) { if ($j) {
if ($j['sites']) { $projects = $this->sort_sites($j);
$projects = $this->sort_sites($j['sites']);
foreach ($projects as $p => $v) { foreach ($projects as $p => $v) {
if (! $p) { if (! $p) {
continue; continue;
@ -55,10 +77,7 @@ class Sites extends \Zotlabs\Web\Controller {
} }
} }
$o .= '</div></div>'; $o .= '</div></div>';
}
}
return $o; return $o;
} }
function sort_sites($a) { 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. * @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 ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1242 ); define ( 'DB_UPDATE_VERSION', 1242 );

View file

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