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

This commit is contained in:
nobody 2020-09-09 02:26:58 -07:00
commit e80e9c3355
33 changed files with 4457 additions and 4049 deletions

View file

@ -0,0 +1,10 @@
location /adminer {
root /usr/share/adminer;
index index.php index.html index.htm;
location ~ ^/adminer/(.+\.php)$ {
try_files $uri $uri/ /index.php?$query_string;
fastcgi_pass unix:PHP_FPM_SOCK;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}

View file

@ -128,6 +128,9 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# include adminer configuration
include /etc/nginx/snippets/adminer-nginx.inc;
# deny access to all dot files
location ~ /\. {
deny all;

View file

@ -245,10 +245,14 @@ function add_vhost {
a2ensite $le_domain
}
function add_nginx_block {
print_info "adding nginx block"
function add_nginx_conf {
print_info "adding nginx conf files"
sed "s|SERVER_NAME|${le_domain}|g;s|INSTALL_PATH|${install_path}|g;s|ZOTSERVER_LOG|${install_folder}-${zotserver}.log|;s|PHP_FPM_SOCK|$(ls /var/run/php/*sock)|;" nginx-zotserver.conf.template >> /etc/nginx/sites-enabled/${le_domain}.conf
ln -s /etc/nginx/sites-enabled/${le_domain}.conf /etc/nginx/sites-available/
if [ ! -f /etc/nginx/snippets/adminer-nginx.inc ]
then
sed "s|PHP_FPM_SOCK|$(ls /var/run/php/*sock)|;" adminer-nginx.inc.template >> /etc/nginx/snippets/adminer-nginx.inc
fi
}
function install_imagemagick {
@ -314,27 +318,30 @@ _EOF_
function install_adminer {
print_info "installing adminer..."
nocheck_install "adminer"
if [ ! -f /etc/adminer/adminer.conf ]
if [ $webserver = "apache" ]
then
echo "Alias /adminer /usr/share/adminer/adminer" > /etc/adminer/adminer.conf
ln -s /etc/adminer/adminer.conf /etc/apache2/conf-available/adminer.conf
else
print_info "file /etc/adminer/adminer.conf exists already"
if [ ! -f /etc/adminer/adminer.conf ]
then
echo "Alias /adminer /usr/share/adminer/adminer" > /etc/adminer/adminer.conf
ln -s /etc/adminer/adminer.conf /etc/apache2/conf-available/adminer.conf
else
print_info "file /etc/adminer/adminer.conf exists already"
fi
a2enmod rewrite
if [ ! -f /etc/apache2/apache2.conf ]
then
die "could not find file /etc/apache2/apache2.conf"
fi
sed -i \
"s/AllowOverride None/AllowOverride all/" \
/etc/apache2/apache2.conf
a2enconf adminer
systemctl restart mariadb
systemctl reload apache2
fi
a2enmod rewrite
if [ ! -f /etc/apache2/apache2.conf ]
then
die "could not find file /etc/apache2/apache2.conf"
fi
sed -i \
"s/AllowOverride None/AllowOverride all/" \
/etc/apache2/apache2.conf
a2enconf adminer
systemctl restart mariadb
systemctl reload apache2
}
function create_zotserver_db {
@ -747,7 +754,7 @@ install_imagemagick
install_php
if [ $webserver = "nginx" ]
then
add_nginx_block
add_nginx_conf
elif [ $webserver = "apache" ]
then
if [ "$install_path" != "/var/www/html" ]
@ -756,10 +763,7 @@ then
fi
fi
install_mysql
if [ $webserver = "apache" ]
then
install_adminer
fi
create_zotserver_db
run_freedns
install_run_selfhost

View file

@ -58,9 +58,9 @@ class Img_cache {
return true;
}
}
if (file_exists($file)) {
unlink($file);
}
// Ignore errors - we don't care if it doesn't exist here.
@unlink($file);
return false;
}

View file

@ -16,6 +16,7 @@ use Zotlabs\Lib\LibBlock;
use Zotlabs\Lib\Activity;
use Zotlabs\Daemon\Run;
require_once('include/html2bbcode.php');
class Libzot {
@ -2741,10 +2742,27 @@ class Libzot {
$sellpage = htmlspecialchars($arr['sellpage'],ENT_COMPAT,'UTF-8',false);
$site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false);
$site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false);
$sitename = htmlspecialchars($arr['sitename'],ENT_COMPAT,'UTF-8',false);
$site_project = htmlspecialchars($arr['project'],ENT_COMPAT,'UTF-8',false);
$site_crypto = ((array_key_exists('encryption',$arr) && is_array($arr['encryption'])) ? htmlspecialchars(implode(',',$arr['encryption']),ENT_COMPAT,'UTF-8',false) : '');
$site_version = ((array_key_exists('version',$arr)) ? htmlspecialchars($arr['version'],ENT_COMPAT,'UTF-8',false) : '');
if (array_key_exists('about',$arr) && $arr['about']) {
$site_about = html2bbcode(purify_html($arr['about']));
}
if (array_key_exists('logo',$arr) && $arr['logo']) {
$site_logo = $arr['logo'];
}
elseif (file_exists('images/' . strtolower($site_project) . '.png')) {
$site_logo = z_root() . '/images/' . strtolower($site_project) . '.png';
}
else {
$site_logo = z_root() . '/images/default_profile_photos/red_koala_trans/300.png';
}
set_sconfig($url,'system','about', $site_about);
set_sconfig($url,'system','logo', $site_logo);
set_sconfig($url,'system','sitename', $sitename);
// You can have one and only one primary directory per realm.
// Downgrade any others claiming to be primary. As they have
// flubbed up this badly already, don't let them be directory servers at all.
@ -3269,6 +3287,12 @@ class Libzot {
}
}
$f = 'images/' . strtolower(System::get_platform_name()) . '.png';
if (file_exists($f)) {
$ret['site']['logo'] = z_root() . '/' . $f;
}
$ret['site']['about'] = bbcode(get_config('system','siteinfo'), [ 'export' => true ]);
$ret['site']['plugins'] = $visible_plugins;
$ret['site']['sitehash'] = get_config('system','location_hash');
$ret['site']['sitename'] = get_config('system','sitename');
@ -3277,7 +3301,6 @@ class Libzot {
$ret['site']['realm'] = get_directory_realm();
$ret['site']['project'] = System::get_platform_name();
$ret['site']['version'] = System::get_project_version();
}
return $ret['site'];

View file

@ -102,10 +102,9 @@ class System {
static public function compatible_project($p) {
if(get_directory_realm() != DIRECTORY_REALM)
return true;
if(in_array(strtolower($p),['hubzilla','zap','red','misty','osada']))
if (in_array(strtolower($p),['hubzilla','zap','red','misty','mistpark','redmatrix','osada'])) {
return true;
}
return false;
}
}

View file

@ -68,7 +68,7 @@ class Acl extends Controller {
$permitted = [];
if (in_array($type, [ 'm', 'a', 'c', 'f' ])) {
if (in_array($type, [ 'm', 'a', 'f' ])) {
// These queries require permission checking. We'll create a simple array of xchan_hash for those with
// the requisite permissions which we can check against.
@ -147,7 +147,7 @@ class Acl extends Controller {
}
if ($type == '' || $type == 'c' || $type === 'f') {
// Getting info from the abook is better for local users because it contains info about permissions
if (local_channel()) {
@ -155,7 +155,7 @@ class Acl extends Controller {
$r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, xchan_type, abook_flags, abook_self
FROM abook left join xchan on abook_xchan = xchan_hash
WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra4 order by xchan_name asc" ,
WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra4 order by xchan_name asc limit $count" ,
intval(local_channel())
);
@ -166,20 +166,21 @@ class Acl extends Controller {
else { // Visitors
$r = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_flags, 0 as abook_self
FROM xchan left join xlink on xlink_link = xchan_hash
WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" ,
WHERE xlink_xchan = '%s' AND xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc limit $count" ,
dbesc(get_observer_hash())
);
}
if ((count($r) < 100) && $type == 'c') {
$r2 = q("SELECT xchan_hash as id, xchan_hash as hash, xchan_name as name, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, 0 as abook_flags, 0 as abook_self
FROM xchan WHERE xchan_deleted = 0 and xchan_network != 'unknown' $sql_extra2 order by $order_extra2 xchan_name asc"
FROM xchan WHERE xchan_deleted = 0 and xchan_network != 'unknown' $sql_extra2 order by $order_extra2 xchan_name asc limit $count"
);
if ($r2) {
$r = array_merge($r,$r2);
$r = unique_multidim_array($r,'hash');
}
}
}
elseif ($type == 'm') {

View file

@ -143,14 +143,14 @@ class Directory extends Controller {
$common = array();
$index = 0;
foreach ($r as $rr) {
$common[$rr['xchan_addr']] = ((intval($rr['total']) > 0) ? intval($rr['total']) - 1 : 0);
$addresses[$rr['xchan_addr']] = $index++;
$common[$rr['xchan_hash']] = ((intval($rr['total']) > 0) ? intval($rr['total']) - 1 : 0);
$addresses[$rr['xchan_hash']] = $index++;
}
// Build query to get info about suggested people
$advanced = '';
foreach (array_keys($addresses) as $address) {
$advanced .= "address=\"$address\" ";
$advanced .= "xhash=\"$address\" ";
}
// Remove last space in the advanced query
$advanced = rtrim($advanced);
@ -379,9 +379,9 @@ class Directory extends Controller {
'keywords' => $out,
'ignlink' => $suggest ? z_root() . '/directory?ignore=' . $rr['hash'] : '',
'ignore_label' => t('Don\'t suggest'),
'common_friends' => (($common[$rr['address']]) ? intval($common[$rr['address']]) : ''),
'common_label' => t('Common connections (at least):'),
'common_count' => intval($common[$rr['address']]),
'common_friends' => (($common[$rr['hash']]) ? intval($common[$rr['hash']]) : ''),
'common_label' => t('Suggestion ranking:'),
'common_count' => intval($common[$rr['hash']]),
'safe' => $safe_mode
];
@ -487,7 +487,7 @@ class Directory extends Controller {
$out = [];
foreach ($suggests as $k => $v) {
foreach ($results as $rv) {
if ($k == $rv['address']) {
if ($k == $rv['hash']) {
$out[intval($v)] = $rv;
break;
}

View file

@ -37,7 +37,7 @@ class Dirsearch extends Controller {
$sql_extra = '';
$tables = [ 'name', 'address', 'locale', 'region', 'postcode',
$tables = [ 'name', 'address', 'xhash', 'locale', 'region', 'postcode',
'country', 'gender', 'marital', 'sexual', 'keywords' ];
// parse advanced query if present
@ -51,6 +51,8 @@ class Dirsearch extends Controller {
$sql_extra .= $this->dir_query_build($adv['logic'],'xchan_name',$adv['value']);
elseif ($adv['field'] === 'address')
$sql_extra .= $this->dir_query_build($adv['logic'],'xchan_addr',$adv['value']);
elseif ($adv['field'] === 'xhash')
$sql_extra .= $this->dir_query_build($adv['logic'],'xchan_hash',$adv['value']);
else
$sql_extra .= $this->dir_query_build($adv['logic'],'xprof_' . $adv['field'],$adv['value']);
}
@ -126,6 +128,9 @@ class Dirsearch extends Controller {
if ($address) {
$sql_extra .= $this->dir_query_build($joiner,'xchan_addr',$address);
}
if ($hash) {
$sql_extra .= $this->dir_query_build($joiner,'xchan_hash',$hash);
}
if ($locale) {
$sql_extra .= $this->dir_query_build($joiner,'xprof_locale',$locale);
}
@ -159,12 +164,7 @@ class Dirsearch extends Controller {
$sql_extra .= " AND xprof_age >= " . intval($agege) . ") ";
}
if($hash) {
$sql_extra = " AND xchan_hash like '" . dbesc($hash) . protect_sprintf('%') . "' ";
}
$perpage = (($_REQUEST['n']) ? $_REQUEST['n'] : 60);
$page = (($_REQUEST['p']) ? intval($_REQUEST['p'] - 1) : 0);
$startrec = (($page+1) * $perpage) - $perpage;

View file

@ -7,76 +7,89 @@ class Sites extends \Zotlabs\Web\Controller {
function get() {
$o .= '<div class="generic-content-wrapper">';
$o .= '<div class="section-title-wrapper"><h2>' . t('Affiliated Sites') . '</h2></div>';
$o .= '<div class="section-content-tools-wrapper"><div class="descriptive-text">' .
$sql_extra = (($_REQUEST['project']) ? " and site_project = '" . escape_tags(protect_sprintf($_REQUEST['project'])) . "' " : "");
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;
$desc = 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.');
$j = [];
$r = q("select * from site where site_type = %d and site_flags != 256 and site_dead = 0",
$r = q("select * from site where site_type = %d and site_flags != 256 and site_dead = 0 $sql_extra order by site_update desc",
intval(SITE_TYPE_ZOT)
);
if ($r) {
foreach ($r as $rr) {
if ($rr['site_access'] == ACCESS_FREE)
$access = 'free';
$access = t('free');
elseif ($rr['site_access'] == ACCESS_PAID)
$access = 'paid';
$access = t('subscription');
elseif ($rr['site_access'] == ACCESS_TIERED)
$access = 'tiered';
$access = t('tiered service plans');
else
$access = 'private';
if ($rr['site_register'] == REGISTER_OPEN)
$register = 'open';
$register = t('Register');
elseif ($rr['site_register'] == REGISTER_APPROVE)
$register = 'approve';
$register = t('Register (requires approval)');
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'] ];
$sitename = get_sconfig($rr['site_url'],'system','sitename',$rr['site_url']);
$disabled = (($access === 'private' || $register === 'closed') ? true : false);
$logo = get_sconfig($rr['site_url'],'system','logo');
$about = get_sconfig($rr['site_url'],'system','about');
if (! $logo && file_exists('images/' . strtolower($rr['site_project']) . '.png')) {
$logo = 'images/' . strtolower($rr['site_project']) . '.png';
}
if (! $logo) {
$logo = 'images/default_profile_photos/red_koala_trans/300.png';
}
if ($rr['site_sellpage']) {
$register_link = $rr['site_sellpage'];
}
else {
$register_link = $rr['site_url'] . '/register';
}
$j[] = [
'profile_link' => $rr['site_url'],
'name' => $sitename,
'access' => $access,
'register' => $register_link,
'sellpage' => $rr['site_sellpage'],
'location_label' => t('Location'),
'location' => $rr['site_location'],
'project' => $rr['site_project'],
'version' => $rr['site_version'],
'photo' => $logo,
'about' => bbcode($about),
'hash' => substr(hash('sha256', $rr['site_url']), 0, 16),
'network_label' => t('Project'),
'network' => $rr['site_project'],
'version_label' => t('Version'),
'version' => $rr['site_version'],
'private' => $disabled,
'connect' => (($disabled) ? '' : $register_link),
'connect_label' => $register,
'access' => (($access === 'private') ? '' : $access),
'access_label' => t('Access type'),
];
}
}
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>';
$o = replace_macros(get_markup_template('sitentry_header.tpl'), [
'$dirlbl' => 'Affiliated Sites',
'$desc' => $desc,
'$entries' => $j,
]);
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;
}

View file

@ -16,85 +16,116 @@ class Superblock extends Controller {
return;
}
$inline = (isset($_REQUEST['manual_block']) ? true : false);
$type = BLOCKTYPE_CHANNEL;
$blocked = trim($_GET['block']);
$blocked = trim($_REQUEST['block']);
if (! $blocked) {
$blocked = trim($_GET['blocksite']);
$blocked = trim($_REQUEST['blocksite']);
if ($blocked) {
$type = BLOCKTYPE_SERVER;
}
}
$m = parse_url($blocked);
if ($m['scheme'] && $m['host'] && (($type === BLOCKTYPE_SERVER) || (! $m['path']))) {
$type = BLOCKTYPE_SERVER;
$blocked = $m['host'];
}
$handled = false;
$ignored = [];
if ($blocked) {
$handled = true;
$r = q("select xchan_url from xchan where xchan_hash = '%s' limit 1",
dbesc($blocked)
);
if ($r) {
if ($type === BLOCKTYPE_SERVER) {
$m = parse_url($r[0]['xchan_url']);
if ($m) {
$blocked = $m['host'];
}
}
$bl = [
'block_channel_id' => local_channel(),
'block_entity' => $blocked,
'block_type' => $type,
'block_comment' => t('Added by Superblock')
];
LibBlock::store($bl);
$sync = [];
$sync['block'] = [ LibBlock::fetch_by_entity(local_channel(),$blocked) ];
if ($type === BLOCKTYPE_CHANNEL) {
$z = q("insert into xign ( uid, xchan ) values ( %d , '%s' ) ",
intval(local_channel()),
dbesc($blocked)
);
$ab = q("select * from abook where abook_channel = %d and abook_xchan = '%s'",
intval(local_channel()),
dbesc($blocked)
);
if (($ab) && (! intval($ab['abook_blocked']))) {
q("update abook set abook_blocked = 1 where abook_channel = %d and abook_xchan = '%s'",
intval(local_channel()),
dbesc($blocked)
);
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_xchan = '%s' LIMIT 1",
intval(local_channel()),
dbesc($blocked)
);
if ($r) {
$r = array_shift($r);
$abconfig = load_abconfig(local_channel(),$blocked);
if ($abconfig) {
$r['abconfig'] = $abconfig;
}
unset($r['abook_id']);
unset($r['abook_account']);
unset($r['abook_channel']);
$sync['abook'] = [ $r ];
if ($type === BLOCKTYPE_CHANNEL) {
$r = q("select xchan_url from xchan where ( xchan_hash = '%s' or xchan_addr = '%s' or xchan_url = '%s' )",
dbesc($blocked),
dbesc($blocked),
dbesc($blocked)
);
if (! $r) {
// not in cache - try discovery
$wf = discover_by_webbie($blocked,'',false);
if (! $wf) {
notice( t('Channel not found.') . EOL);
if ($inline) {
return;
}
killme();
}
if ($wf) {
// something was discovered - find the record which was just created.
$r = q("select * from xchan where ( xchan_hash = '%s' or xchan_url = '%s' or xchan_addr = '%s' )",
dbesc(($wf) ? $wf : $blocked),
dbesc($blocked),
dbesc($blocked)
);
}
$sync['xign'] = [[ 'uid' => local_channel(), 'xchan' => $_GET['block'] ]];
}
Libsync::build_sync_packet(0, $sync);
if ($r) {
$r = Libzot::zot_record_preferred($r,'xchan_network');
}
}
$bl = [
'block_channel_id' => local_channel(),
'block_entity' => $blocked,
'block_type' => $type,
'block_comment' => t('Added by Superblock')
];
LibBlock::store($bl);
$sync = [];
$sync['block'] = [ LibBlock::fetch_by_entity(local_channel(),$blocked) ];
if ($type === BLOCKTYPE_CHANNEL) {
$z = q("insert into xign ( uid, xchan ) values ( %d , '%s' ) ",
intval(local_channel()),
dbesc($blocked)
);
$ab = q("select * from abook where abook_channel = %d and abook_xchan = '%s'",
intval(local_channel()),
dbesc($blocked)
);
if (($ab) && (! intval($ab['abook_blocked']))) {
q("update abook set abook_blocked = 1 where abook_channel = %d and abook_xchan = '%s'",
intval(local_channel()),
dbesc($blocked)
);
$r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash WHERE abook_channel = %d and abook_xchan = '%s' LIMIT 1",
intval(local_channel()),
dbesc($blocked)
);
if ($r) {
$r = array_shift($r);
$abconfig = load_abconfig(local_channel(),$blocked);
if ($abconfig) {
$r['abconfig'] = $abconfig;
}
unset($r['abook_id']);
unset($r['abook_account']);
unset($r['abook_channel']);
$sync['abook'] = [ $r ];
}
}
$sync['xign'] = [[ 'uid' => local_channel(), 'xchan' => $_GET['block'] ]];
}
Libsync::build_sync_packet(0, $sync);
}
$type = BLOCKTYPE_CHANNEL;
$unblocked = trim($_GET['unblock']);
$unblocked = trim($_REQUEST['unblock']);
if (! $unblocked) {
$unblocked = trim($_GET['unblocksite']);
$unblocked = trim($_REQUEST['unblocksite']);
if ($unblocked) {
$type = BLOCKTYPE_SERVER;
}
@ -148,7 +179,7 @@ class Superblock extends Controller {
info( t('superblock settings updated') . EOL );
if ($unblocked) {
if ($unblocked || $inline) {
return;
}
@ -184,6 +215,7 @@ class Superblock extends Controller {
'$remove' => t('Remove')
]);
$l = LibBlock::fetch(local_channel(),BLOCKTYPE_SERVER);
$list = ids_to_array($l,'block_entity');
if ($list) {

24
Zotlabs/Widget/Sblock.php Normal file
View file

@ -0,0 +1,24 @@
<?php
namespace Zotlabs\Widget;
use App;
class Sblock {
function widget($args) {
if (! local_channel()) {
return EMPTY_STR;
}
return replace_macros(get_markup_template('superblock_widget.tpl'), [
'$connect' => t('Block channel or site'),
'$desc' => t('Enter channel address or URL'),
'$hint' => t('Examples: bob@example.com, https://example.com/barbara'),
'$follow' => t('Block'),
'$abook_usage_message' => '',
]);
}
}

View file

@ -0,0 +1,41 @@
<?php
namespace Zotlabs\Widget;
class Site_projects {
function widget($args) {
$r = q("select site_project, count(site_project) as total from site where site_project != '' and site_flags != 256 and site_dead = 0 group by site_project order by site_project desc");
$results = [];
if ($r) {
foreach ($r as $rv) {
$result = [];
$result['name'] = $rv['site_project'];
$result['cname'] = ucfirst($result['name']);
if ($rv['site_project'] === $_REQUEST['project']) {
$result['selected'] = true;
}
$result['total'] = $rv['total'];
$results[] = $result;
}
$o = replace_macros(get_markup_template('site_projects.tpl'), [
'$title' => t('Projects'),
'$desc' => '',
'$all' => t('All projects'),
'base' => z_root() . '/sites',
'$sel_all' => (($_REQUEST['project']) ? false : true),
'$terms' => $results
]);
return $o;
}
}
}

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.03' );
define ( 'STD_VERSION', '20.09.09' );
define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1242 );

BIN
images/hubzilla-64.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
images/hubzilla.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

62
images/hubzilla.svg Normal file
View file

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg4599"
sodipodi:docname="hubzilla.svg"
inkscape:export-filename="/home/workshop/Downloads/_Hubzilla.png"
inkscape:export-xdpi="2400"
inkscape:export-ydpi="2400"
inkscape:version="0.92.5 (2060ec1f9f, 2020-04-08)">
<metadata
id="metadata4605">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs4603" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1027"
inkscape:window-height="779"
id="namedview4601"
showgrid="false"
inkscape:zoom="9.8333333"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="72"
inkscape:window-y="27"
inkscape:window-maximized="0"
inkscape:current-layer="svg4599" />
<path
fill="#43488A"
d="M6.076 5.518L.214 8.986l1.57.045 1.568.046.027 6.256.017 6.247h17.118V9.12l1.63-.017 1.642-.026-5.87-3.487c-3.227-1.918-5.897-3.503-5.924-3.512-.028-.02-2.69 1.53-5.917 3.44z"
id="path4595" />
<path
fill="#FFF"
d="M16.314 7.955c.69.34 1.326.995 1.66 1.703.13.316.268.628.24 1.362-.024.663-.07.923-.277 1.363-.546 1.165-1.622 1.945-2.85 2.026l-.664.044-.233.922c-.196.768-.215 1.027-.215 1.027.223.235.726.382.938.926.286.555.253 1.344-.114 1.8-.6.745-1.497.97-2.285.557-.718-.376-1.093-1.31-.87-2.125.054-.206-.01-.268-.868-.833l-.933-.62-.34.278c-1.623 1.3-3.998.154-3.99-1.936 0-1.345 1.068-2.393 2.44-2.384.688 0 1.1.153 1.612.62l.376.34.834-.42.843-.413-.09-.296c-.127-.44-.1-1.417.052-1.91.17-.592.7-1.327 1.2-1.695 1.023-.75 2.422-.886 3.532-.34zm-6.158 7.6l1.867 1.284s.567-.48 1.337-.547l.478-2.03s-1.48-.48-1.897-1.517l-1.73.82c0 .002.41 1.025-.054 1.988z"
id="path4597" />
</svg>

After

Width:  |  Height:  |  Size: 2.5 KiB

View file

@ -2577,7 +2577,7 @@ function tag_deliver($uid, $item_id) {
$terms = get_terms_oftype($item['term'],TERM_MENTION);
$pterms = get_terms_oftype($item['term'],TERM_PCATEGORY);
$pterms = get_terms_oftype($item['term'], [TERM_PCATEGORY, TERM_HASHTAG] );
if ($terms) {
logger('Post mentions: ' . print_r($terms,true), LOGGER_DATA);
@ -2665,12 +2665,17 @@ function tag_deliver($uid, $item_id) {
$ptagged = false;
if (! link_compare($term['url'],$link)) {
if (link_compare($term['url'],$link)) {
$ptagged = true;
}
elseif ($term['ttype'] === TERM_HASHTAG && strtolower($term['term']) === strtolower($u['channel_address'])) {
$ptagged = true;
}
if (! $ptagged) {
continue;
}
$ptagged = true;
logger('Collection post found for ' . $u['channel_name']);
// ptagged - keep going, next check permissions

View file

@ -163,7 +163,7 @@ function poco_load($xchan = '', $url = null) {
continue;
}
$x = q("select xchan_hash from xchan where ( xchan_hash = '%s' or xchan_url = '%s' ) limit 1",
$x = q("select xchan_hash from xchan where ( xchan_hash = '%s' or xchan_url = '%s' ) order by xchan_network desc limit 1",
dbesc($hash),
dbesc($hash)
);
@ -175,11 +175,13 @@ function poco_load($xchan = '', $url = null) {
if(in_array($network, ['zot6' , 'activitypub'])) {
$wf = discover_by_webbie($profile_url);
if ($wf) {
$x = q("select xchan_hash from xchan where ( xchan_hash = '%s' or xchan_url = '%s') limit 1",
$x = q("select xchan_hash from xchan where ( xchan_hash = '%s' or xchan_url = '%s') order by xchan_network desc limit 1",
dbesc($wf),
dbesc($wf)
);
$hash = $wf;
if ($x) {
$hash = $x[0]['xchan_hash'];
}
}
if(! $x) {
continue;
@ -268,7 +270,7 @@ function ap_poco_load($xchan) {
$hash = EMPTY_STR;
$x = q("select xchan_hash from xchan where (xchan_hash = '%s' or xchan_url = '%s') limit 1",
$x = q("select xchan_hash from xchan where (xchan_hash = '%s' or xchan_url = '%s') order by xchan_network desc limit 1",
dbesc($entry),
dbesc($entry)
);
@ -283,11 +285,13 @@ function ap_poco_load($xchan) {
$wf = discover_by_webbie($entry);
if ($wf) {
$x = q("select xchan_hash from xchan where (xchan_hash = '%s' or xchan_url = '%s') limit 1",
$x = q("select xchan_hash from xchan where (xchan_hash = '%s' or xchan_url = '%s') order by xchan_network desc limit 1",
dbesc($wf),
dbesc($wf)
);
$hash = $wf;
if ($x) {
$hash = $x[0]['xchan_hash'];
}
}
}

View file

@ -2803,7 +2803,12 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
// $r is set if we found something
if ($r) {
$r = [ Libzot::zot_record_preferred($r) ];
if (array_key_exists('hubloc_network',$r)) {
$r = [ Libzot::zot_record_preferred($r) ];
}
else {
$r = [ Libzot::zot_record_preferred($r, 'xchan_network') ];
}
}
if ($r) {

34
view/css/mod_sites.css Normal file
View file

@ -0,0 +1,34 @@
.directory-photo-img {
width: 80px;
height: 80px;
border: none;
}
.section-content-tools-wrapper {
padding-bottom: 20px;
}
.contact-photo-wrapper {
display: table-cell;
table-layout: fixed;
vertical-align: top;
}
.contact-info {
display: table-cell;
table-layout: fixed;
vertical-align: top;
padding-left: 10px;
}
.contact-info-label {
font-weight: bold;
}
.section-subtitle-wrapper .btn-xs {
margin-top: -2px;
}
.directory-collapse {
overflow: hidden;
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1150,8 +1150,8 @@ function pageUpdate() {
bParam_page = 1;
}
update_url = baseurl + '/' + page_query + '/?f=&aj=1&page=' + bParam_page + extra_args ;
update_url = baseurl + '/' + decodeURIComponent(page_query) + '/?f=&aj=1&page=' + bParam_page + extra_args ;
$("#page-spinner").show();
update_mode = 'append';

View file

@ -0,0 +1,4 @@
$(document).ready(function() {
$("#follow_input").discover_autocomplete(baseurl + '/acl', 'x', true);
});

7
view/pdl/mod_sites.pdl Normal file
View file

@ -0,0 +1,7 @@
[region=aside]
[widget=site_projects][/widget]
[/region]
[region=right_aside]
[widget=notifications][/widget]
[widget=newmember][/widget]
[/region]

View file

@ -0,0 +1,8 @@
[region=aside]
[widget=sblock][/widget]
[/region]
[region=right_aside]
[widget=notifications][/widget]
[widget=newmember][/widget]
[/region]

View file

@ -1,9 +1,6 @@
<div class="directory-item{{if $entry.safe}} safe{{/if}}" id="directory-item-{{$entry.hash}}" >
<div class="section-subtitle-wrapper clearfix">
<div class="pull-right">
{{if $entry.viewrate}}
{{if $entry.total_ratings}}<a href="ratings/{{$entry.hash}}" id="dir-rating-{{$entry.hash}}" class="btn btn-outline-secondary btn-sm">{{$entry.total_ratings}}</a>{{/if}}
{{/if}}
{{if $entry.ignlink}}
<a class="directory-ignore btn btn-warning btn-sm" href="{{$entry.ignlink}}"> {{$entry.ignore_label}}</a>
{{/if}}
@ -13,9 +10,6 @@
{{if $entry.connect}}
<a class="btn btn-success btn-sm" href="{{$entry.connect}}"><i class="fa fa-plus connect-icon"></i> {{$entry.conn_label}}</a>
{{/if}}
{{if $entry.viewrate}}
{{if $entry.canrate}}<button class="btn btn-outline-secondary btn-sm" onclick="doRatings('{{$entry.hash}}'); return false;" ><i class="fa fa-pencil"></i><span id="edited-{{$entry.hash}}" class="required" id="edited-{{$entry.hash}}" style="display: none;" >&nbsp;*</span></button>{{/if}}
{{/if}}
</div>
<h3>{{if $entry.type == 2}}<i class="fa fa-tags" title="{{$entry.collections_label}}"></i>&nbsp;{{elseif $entry.type == 1}}<i class="fa fa-comments-o" title="{{$entry.forum_label}}"></i>&nbsp;{{/if}}<a href='{{$entry.profile_link}}' >{{$entry.name}}</a>{{if $entry.online}}&nbsp;<i class="fa fa-asterisk online-now" title="{{$entry.online}}"></i>{{/if}}</h3>
</div>

View file

@ -0,0 +1,11 @@
<div id="projects-sidebar" class="widget">
<h3>{{$title}}</h3>
<div id="projects-sidebar-desc">{{$desc}}</div>
<ul class="nav nav-pills flex-column">
<li class="nav-item"><a href="{{$base}}" class="nav-link{{if $sel_all}} active{{/if}}">{{$all}}</a></li>
{{foreach $terms as $term}}
<li class="nav-item"><a href="{{$base}}?project={{$term.name|urlencode}}" class="nav-link{{if $term.selected}} active{{/if}}">{{$term.cname}}</a></li>
{{/foreach}}
</ul>
</div>

83
view/tpl/sitentry.tpl Normal file
View file

@ -0,0 +1,83 @@
<div class="directory-item{{if $entry.safe}} safe{{/if}}" id="directory-item-{{$entry.hash}}" >
<div class="section-subtitle-wrapper clearfix">
<div class="pull-right">
{{if $entry.ignlink}}
<a class="directory-ignore btn btn-warning btn-sm" href="{{$entry.ignlink}}"> {{$entry.ignore_label}}</a>
{{/if}}
{{if $entry.censor}}
<a class="directory-censor btn btn-danger btn-sm" href="{{$entry.censor}}"> {{$entry.censor_label}}</a>
{{/if}}
{{if $entry.connect}}
<a class="btn btn-success btn-sm" href="{{$entry.connect}}"><i class="fa fa-plus connect-icon"></i> {{$entry.connect_label}}</a>
{{else}}
<button class="btn btn-warning btn-sm" disabled><i class="fa fa-lock fa-fw connect-icon"></i></button>
{{/if}}
</div>
<h3><a href='{{$entry.profile_link}}' >{{$entry.name}}</a></h3>
</div>
<div class="section-content-tools-wrapper directory-collapse">
<div class="contact-photo-wrapper" id="directory-photo-wrapper-{{$entry.hash}}" >
<div class="contact-photo" id="directory-photo-{{$entry.hash}}" >
<a href="{{$entry.profile_link}}" class="directory-profile-link" id="directory-profile-link-{{$entry.hash}}" >
<img class="directory-photo-img" src="{{$entry.photo}}" height="80" width="80" alt="{{$entry.alttext}}" title="{{$entry.alttext}}" >
</a>
</div>
</div>
<div class="contact-info">
{{if $entry.network}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.network_label}}</span> {{$entry.network}}
</div>
{{/if}}
{{if $entry.version}}
<div id="dir-common" class="contact-info-element">
<span class="contact-info-label">{{$entry.version_label}}</span> {{$entry.version}}
</div>
{{/if}}
{{if $entry.access}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.access_label}}</span> {{$entry.access}}
</div>
{{/if}}
{{if $entry.age}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.age_label}}</span> {{$entry.age}}
</div>
{{/if}}
{{if $entry.location}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.location_label}}</span> {{$entry.location}}
</div>
{{/if}}
{{if $entry.hometown}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.hometown_label}}</span> {{$entry.hometown}}
</div>
{{/if}}
{{if $entry.homepage}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.homepage}}</span> {{$entry.homepageurl}}
</div>
{{/if}}
{{if $entry.kw}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.kw}}</span> {{$entry.keywords}}
</div>
{{/if}}
{{if $entry.about}}
<div class="contact-info-element">
<span class="contact-info-label">{{$entry.about_label}}</span> {{$entry.about}}
</div>
{{/if}}
</div>
</div>
</div>

View file

@ -0,0 +1,14 @@
<div class="generic-content-wrapper">
<div class="section-title-wrapper clearfix">
<h2>{{$dirlbl}}</h2>
</div>
<div class="descriptive-text" style="margin: 5px;">{{$desc}}</div>
{{foreach $entries as $entry}}
{{include file="sitentry.tpl"}}
{{/foreach}}
<div id="page-end"></div>
</div>
<script>$(document).ready(function() { loadingPage = false;});</script>
<div id="page-spinner" class="spinner-wrapper">
<div class="spinner m"></div>
</div>

View file

@ -10,7 +10,7 @@
<li>
<div>
<a class="pull-right" href="superblock?f=&unblocksite={{$e.1}}&sectok={{$token}}" title="{{$remove}}"><i class="fa fa-trash"></i></a>
<a class="zid" href="{{$e.0}}">&nbsp;{{$e.0}}</a>
<a href="https://{{$e.0}}">&nbsp;{{$e.0}}</a>
</div>
</li>
{{/foreach}}

12
view/tpl/superblock_widget.tpl Executable file
View file

@ -0,0 +1,12 @@
<div id="follow-sidebar" class="widget">
<h3>{{$connect}}</h3>
<form action="superblock" method="post" >
<div class="input-group">
<input class="form-control" id="follow_input" type="text" name="block" title="{{$hint}}" placeholder="{{$desc}}" >
<input type="hidden" name="manual_block" value="1">
<div class="input-group-append">
<button class="btn btn-sm btn-success" type="submit" name="submit" value="{{$follow}}" title="{{$follow}}"><i class="fa fa-fw fa-plus"></i></button>
</div>
</div>
</form>
</div>