cleanup - filter "unsafe" entries from driectory tag cloud

This commit is contained in:
zotlabs 2019-06-20 23:17:04 -07:00
parent 5e189cb14e
commit 17599db5c9
10 changed files with 219 additions and 194 deletions

View file

@ -2185,7 +2185,7 @@ class Activity {
$s['item_private'] = 1;
if (array_key_exists('directMessage',$act->obj)) {
if (array_key_exists('directMessage',$act->obj) && intval($act->obj['directMessage'])) {
$s['item_private'] = 2;
}

View file

@ -429,12 +429,12 @@ class Calendar extends Controller {
'end' => $end,
'drop' => $drop,
'allDay' => $allDay,
'title' => htmlentities($rr['summary'], ENT_COMPAT, 'UTF-8'),
'title' => html_entity_decode($rr['summary'], ENT_COMPAT, 'UTF-8'),
'editable' => $edit ? true : false,
'item' => $rr,
'plink' => [ $rr['plink'], t('Link to source') ],
'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8'),
'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8'),
'description' => htmlentities($rr['description'], ENT_COMPAT, 'UTF-8',false),
'location' => htmlentities($rr['location'], ENT_COMPAT, 'UTF-8',false),
'allow_cid' => expand_acl($rr['allow_cid']),
'allow_gid' => expand_acl($rr['allow_gid']),
'deny_cid' => expand_acl($rr['deny_cid']),
@ -443,7 +443,7 @@ class Calendar extends Controller {
];
}
}
if ($export) {
header('Content-type: text/calendar');
header('content-disposition: attachment; filename="' . t('calendar') . '-' . $channel['channel_address'] . '.ics"' );

View file

@ -18,14 +18,13 @@ class Directory extends Controller {
function init() {
App::set_pager_itemspage(DIRECTORY_PAGESIZE);
if(x($_GET,'ignore') && local_channel()) {
if (x($_GET,'ignore') && local_channel()) {
q("insert into xign ( uid, xchan ) values ( %d, '%s' ) ",
intval(local_channel()),
dbesc($_GET['ignore'])
);
Libsync::build_sync_packet(local_channel(), [ 'xign' => [ [ 'uid' => local_channel(), 'xchan' => $_GET['ignore'] ]]] );
Libsync::build_sync_packet(local_channel(), [ 'xign' => [ [ 'uid' => local_channel(), 'xchan' => $_GET['ignore'] ]]] );
goaway(z_root() . '/directory?f=&suggest=1');
}
@ -34,62 +33,63 @@ class Directory extends Controller {
$safe_changed = false;
$type_changed = false;
if(array_key_exists('global',$_REQUEST)) {
if (array_key_exists('global',$_REQUEST)) {
$globaldir = intval($_REQUEST['global']);
if(get_config('system','localdir_hide')) {
if (get_config('system','localdir_hide')) {
$globaldir = 1;
}
$global_changed = true;
}
if($global_changed) {
if ($global_changed) {
$_SESSION['globaldir'] = $globaldir;
if($observer)
if ($observer) {
set_xconfig($observer,'directory','globaldir',$globaldir);
}
}
if(array_key_exists('safe',$_REQUEST)) {
if (array_key_exists('safe',$_REQUEST)) {
$safemode = intval($_REQUEST['safe']);
$safe_changed = true;
}
if($safe_changed) {
if ($safe_changed) {
$_SESSION['safemode'] = $safemode;
if($observer)
if ($observer) {
set_xconfig($observer,'directory','safemode',$safemode);
}
}
if(array_key_exists('type',$_REQUEST)) {
if (array_key_exists('type',$_REQUEST)) {
$type = intval($_REQUEST['type']);
$type_changed = true;
}
if($type_changed) {
if ($type_changed) {
$_SESSION['chantype'] = $type;
if($observer)
if ($observer) {
set_xconfig($observer,'directory','chantype',$type);
}
}
}
function get() {
if(observer_prohibited()) {
if (observer_prohibited()) {
notice( t('Public access denied.') . EOL);
return;
}
if(get_config('system','block_public_directory',false) && (! get_observer_hash())) {
$observer = get_observer_hash();
if (get_config('system','block_public_directory',false) && (! $observer)) {
notice( t('Public access denied.') . EOL);
return;
}
$observer = get_observer_hash();
$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']))
if (intval($_REQUEST['navsearch'])) {
$globaldir = 1;
}
$safe_mode = Libzotdir::get_directory_setting($observer, 'safemode');
@ -98,21 +98,23 @@ class Directory extends Controller {
$o = '';
nav_set_selected('Directory');
if(x($_POST,'search'))
if (x($_POST,'search')) {
$search = notags(trim($_POST['search']));
else
}
else {
$search = ((x($_GET,'search')) ? notags(trim(rawurldecode($_GET['search']))) : '');
}
if(strpos($search,'=') && local_channel() && feature_enabled(local_channel(), 'advanced_dirsearch'))
if (strpos($search,'=')) {
$advanced = $search;
}
$keywords = (($_GET['keywords']) ? $_GET['keywords'] : '');
// Suggest channels if no search terms or keywords are given
$suggest = (local_channel() && x($_REQUEST,'suggest')) ? $_REQUEST['suggest'] : '';
if($suggest) {
if ($suggest) {
// the directory options have no effect in suggestion mode
@ -120,14 +122,13 @@ class Directory extends Controller {
$safe_mode = 1;
$type = 0;
// only return DIRECTORY_PAGESIZE suggestions as the suggestion sorting
// 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);
if(! $r) {
if (! $r) {
notice( t('No default suggestions were found.') . EOL);
return;
}
@ -136,14 +137,14 @@ class Directory extends Controller {
$addresses = array();
$common = array();
$index = 0;
foreach($r as $rr) {
foreach ($r as $rr) {
$common[$rr['xchan_addr']] = ((intval($rr['total']) > 0) ? intval($rr['total']) - 1 : 0);
$addresses[$rr['xchan_addr']] = $index++;
}
// Build query to get info about suggested people
$advanced = '';
foreach(array_keys($addresses) as $address) {
foreach (array_keys($addresses) as $address) {
$advanced .= "address=\"$address\" ";
}
// Remove last space in the advanced query
@ -172,76 +173,85 @@ class Directory extends Controller {
}
$token = get_config('system','realm_token');
logger('mod_directory: URL = ' . $url, LOGGER_DEBUG);
$contacts = array();
if(local_channel()) {
if (local_channel()) {
$x = q("select abook_xchan from abook where abook_channel = %d",
intval(local_channel())
);
if($x) {
foreach($x as $xx)
if ($x) {
foreach ($x as $xx) {
$contacts[] = $xx['abook_xchan'];
}
}
}
if($url) {
if ($url) {
$numtags = get_config('system','directorytags');
$kw = ((intval($numtags) > 0) ? intval($numtags) : 50);
if(get_config('system','disable_directory_keywords'))
if (get_config('system','disable_directory_keywords')) {
$kw = 0;
}
$query = $url . '?f=&kw=' . $kw . (($safe_mode != 1) ? '&safe=' . $safe_mode : '');
if($token)
if ($token) {
$query .= '&t=' . $token;
if(! $globaldir)
}
if (! $globaldir) {
$query .= '&hub=' . App::get_hostname();
if($search)
}
if ($search) {
$query .= '&name=' . urlencode($search) . '&keywords=' . urlencode($search);
if(strpos($search,'@'))
}
if (strpos($search,'@')) {
$query .= '&address=' . urlencode($search);
if($keywords)
}
if ($keywords) {
$query .= '&keywords=' . urlencode($keywords);
if($advanced)
}
if ($advanced) {
$query .= '&query=' . urlencode($advanced);
if(! is_null($type))
}
if (! is_null($type)) {
$query .= '&type=' . intval($type);
}
$directory_sort_order = get_config('system','directory_sort_order');
if(! $directory_sort_order)
if (! $directory_sort_order) {
$directory_sort_order = 'date';
}
$sort_order = ((x($_REQUEST,'order')) ? $_REQUEST['order'] : $directory_sort_order);
if($sort_order)
if ($sort_order) {
$query .= '&order=' . urlencode($sort_order);
}
if(App::$pager['page'] != 1)
if (App::$pager['page'] != 1) {
$query .= '&p=' . App::$pager['page'];
}
logger('mod_directory: query: ' . $query);
$x = z_fetch_url($query);
// logger('directory: return from upstream: ' . print_r($x,true), LOGGER_DATA);
if($x['success']) {
if ($x['success']) {
$t = 0;
$j = json_decode($x['body'],true);
if($j) {
if ($j) {
if($j['results']) {
if ($j['results']) {
$results = $j['results'];
if($suggest) {
if ($suggest) {
// change order to "number of common friends descending"
$results = self::reorder_results($results,$addresses);
}
@ -250,7 +260,7 @@ class Directory extends Controller {
$photo = 'thumb';
foreach($results as $rr) {
foreach ($results as $rr) {
$profile_link = chanlink_url($rr['url']);
@ -261,54 +271,52 @@ class Directory extends Controller {
//$online = remote_online_status($rr['address']);
$online = '';
if(in_array($rr['hash'],$contacts))
if (in_array($rr['hash'],$contacts)) {
$connect_link = '';
}
$location = '';
if(strlen($rr['locale']))
if (strlen($rr['locale'])) {
$location .= $rr['locale'];
if(strlen($rr['region'])) {
if(strlen($rr['locale']))
}
if (strlen($rr['region'])) {
if (strlen($rr['locale'])) {
$location .= ', ';
}
$location .= $rr['region'];
}
if(strlen($rr['country'])) {
if(strlen($location))
if (strlen($rr['country'])) {
if (strlen($location)) {
$location .= ', ';
}
$location .= $rr['country'];
}
$age = '';
if(strlen($rr['birthday'])) {
if(($years = age($rr['birthday'],'UTC','')) > 0)
if (strlen($rr['birthday'])) {
if (($years = age($rr['birthday'],'UTC','')) > 0) {
$age = $years;
}
}
$page_type = '';
$rating_enabled = get_config('system','rating_enabled');
if($rr['total_ratings'] && $rating_enabled)
if ($rr['total_ratings'] && $rating_enabled) {
$total_ratings = sprintf( tt("%d rating", "%d ratings", $rr['total_ratings']), $rr['total_ratings']);
else
}
else {
$total_ratings = '';
}
$profile = $rr;
if ((x($profile,'locale') == 1)
|| (x($profile,'region') == 1)
|| (x($profile,'postcode') == 1)
|| (x($profile,'country') == 1))
$gender = ((x($profile,'gender') == 1) ? t('Gender: ') . $profile['gender']: False);
$marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital']: False);
$marital = ((x($profile,'marital') == 1) ? t('Status: ') . $profile['marital']: False);
$homepage = ((x($profile,'homepage') == 1) ? t('Homepage: ') : False);
$homepageurl = ((x($profile,'homepage') == 1) ? html2plain($profile['homepage']) : '');
$homepageurl = ((x($profile,'homepage') == 1) ? html2plain($profile['homepage']) : '');
$hometown = ((x($profile,'hometown') == 1) ? html2plain($profile['hometown']) : False);
$about = ((x($profile,'about') == 1) ? zidify_links(bbcode($profile['about'])) : False);
if ($about && $safe_mode) {
$about = html2plain($about);
@ -316,81 +324,82 @@ class Directory extends Controller {
$keywords = ((x($profile,'keywords')) ? $profile['keywords'] : '');
$out = '';
if($keywords) {
if ($keywords) {
$keywords = str_replace(',',' ', $keywords);
$keywords = str_replace(' ',' ', $keywords);
$karr = explode(' ', $keywords);
if($karr) {
if(local_channel()) {
if ($karr) {
if (local_channel()) {
$r = q("select keywords from profile where uid = %d and is_default = 1 limit 1",
intval(local_channel())
);
if($r) {
if ($r) {
$keywords = str_replace(',',' ', $r[0]['keywords']);
$keywords = str_replace(' ',' ', $keywords);
$marr = explode(' ', $keywords);
}
}
foreach($karr as $k) {
if(strlen($out))
foreach ($karr as $k) {
if (strlen($out)) {
$out .= ', ';
if($marr && in_arrayi($k,$marr))
}
if ($marr && in_arrayi($k,$marr)) {
$out .= '<a href="' . z_root() . '/directory/f=&keywords=' . urlencode($k) .'"><strong>' . $k . '</strong></a>';
else
}
else {
$out .= '<a href="' . z_root() . '/directory/f=&keywords=' . urlencode($k) .'">' . $k . '</a>';
}
}
}
}
$entry = array(
'id' => ++$t,
'profile_link' => $profile_link,
'type' => $rr['type'],
'photo' => $rr['photo'],
'hash' => $rr['hash'],
'alttext' => $rr['name'] . ((local_channel() || remote_channel()) ? ' ' . $rr['address'] : ''),
'name' => $rr['name'],
'age' => $age,
'age_label' => t('Age:'),
'profile' => $profile,
'address' => $rr['address'],
'nickname' => substr($rr['address'],0,strpos($rr['address'],'@')),
'location' => $location,
'location_label' => t('Location:'),
'gender' => $gender,
'total_ratings' => $total_ratings,
'viewrate' => true,
'canrate' => (($rating_enabled && local_channel()) ? true : false),
'pdesc' => $pdesc,
'pdesc_label' => t('Description:'),
'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] : ''),
'censor_label' => (($rr['censored']) ? t('Uncensor') : t('Censor')),
'marital' => $marital,
'homepage' => $homepage,
'homepageurl' => (($safe_mode) ? $homepageurl : linkify($homepageurl)),
'hometown' => $hometown,
'hometown_label' => t('Hometown:'),
'about' => $about,
'about_label' => t('About:'),
'conn_label' => t('Connect'),
'forum_label' => t('Group'),
$entry = [
'id' => ++ $t,
'profile_link' => $profile_link,
'type' => $rr['type'],
'photo' => $rr['photo'],
'hash' => $rr['hash'],
'alttext' => $rr['name'] . ((local_channel() || remote_channel()) ? ' ' . $rr['address'] : ''),
'name' => $rr['name'],
'age' => $age,
'age_label' => t('Age:'),
'profile' => $profile,
'address' => $rr['address'],
'nickname' => substr($rr['address'],0,strpos($rr['address'],'@')),
'location' => $location,
'location_label' => t('Location:'),
'gender' => $gender,
'total_ratings' => $total_ratings,
'viewrate' => true,
'canrate' => (($rating_enabled && local_channel()) ? true : false),
'pdesc' => $pdesc,
'pdesc_label' => t('Description:'),
'censor' => (($directory_admin) ? 'dircensor/' . $rr['hash'] : ''),
'censor_label' => (($rr['censored']) ? t('Uncensor') : t('Censor')),
'marital' => $marital,
'homepage' => $homepage,
'homepageurl' => (($safe_mode) ? $homepageurl : linkify($homepageurl)),
'hometown' => $hometown,
'hometown_label' => t('Hometown:'),
'about' => $about,
'about_label' => t('About:'),
'conn_label' => t('Connect'),
'forum_label' => t('Group'),
'collections_label' => t('Collection'),
'connect' => $connect_link,
'online' => $online,
'kw' => (($out) ? t('Keywords: ') : ''),
'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 (estimated):'),
'common_count' => intval($common[$rr['address']]),
'safe' => $safe_mode
);
'connect' => $connect_link,
'online' => $online,
'kw' => (($out) ? t('Keywords: ') : ''),
'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 (estimated):'),
'common_count' => intval($common[$rr['address']]),
'safe' => $safe_mode
];
$arr = array('contact' => $rr, 'entry' => $entry);
@ -399,14 +408,13 @@ class Directory extends Controller {
unset($profile);
unset($location);
if(! $arr['entry']) {
if (! $arr['entry']) {
continue;
}
if($sort_order == '' && $suggest) {
if ($sort_order == '' && $suggest) {
$entries[$addresses[$rr['address']]] = $arr['entry']; // Use the same indexes as originally to get the best suggestion first
}
else {
$entries[] = $arr['entry'];
}
@ -414,18 +422,16 @@ class Directory extends Controller {
ksort($entries); // Sort array by key so that foreach-constructs work as expected
if($j['keywords']) {
if ($j['keywords']) {
App::$data['directory_keywords'] = $j['keywords'];
}
// logger('mod_directory: entries: ' . print_r($entries,true), LOGGER_DATA);
if($_REQUEST['aj']) {
if($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'),array(
'$entries' => $entries
));
if ($_REQUEST['aj']) {
if ($entries) {
$o = replace_macros(get_markup_template('directajax.tpl'), [ '$entries' => $entries ] );
}
else {
$o = '<div id="content-complete"></div>';
@ -439,34 +445,31 @@ class Directory extends Controller {
$dirtitle = (($globaldir) ? t('Global Directory') : t('Local Directory'));
$o .= "<script> var page_query = '" . escape_tags(urlencode($_GET['req'])) . "'; var extra_args = '" . extra_query_args() . "' ; divmore_height = " . intval($maxheight) . "; </script>";
$o .= replace_macros($tpl, array(
'$search' => $search,
'$desc' => t('Find'),
'$finddsc' => t('Finding:'),
'$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'),
'$entries' => $entries,
'$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle,
'$submit' => t('Find'),
'$next' => alt_pager($j['records'], t('next page'), t('previous page')),
'$sort' => t('Sort options'),
'$normal' => t('Alphabetic'),
'$reverse' => t('Reverse Alphabetic'),
'$date' => t('Newest to Oldest'),
$o .= replace_macros($tpl, [
'$search' => $search,
'$desc' => t('Find'),
'$finddsc' => t('Finding:'),
'$safetxt' => htmlspecialchars($search,ENT_QUOTES,'UTF-8'),
'$entries' => $entries,
'$dirlbl' => $suggest ? t('Channel Suggestions') : $dirtitle,
'$submit' => t('Find'),
'$next' => alt_pager($j['records'], t('next page'), t('previous page')),
'$sort' => t('Sort options'),
'$normal' => t('Alphabetic'),
'$reverse' => t('Reverse Alphabetic'),
'$date' => t('Newest to Oldest'),
'$reversedate' => t('Oldest to Newest'),
'$suggest' => $suggest ? '&suggest=1' : ''
));
'$suggest' => $suggest ? '&suggest=1' : ''
]);
}
}
else {
if($_REQUEST['aj']) {
if ($_REQUEST['aj']) {
$o = '<div id="content-complete"></div>';
echo $o;
killme();
}
if(\App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) {
if (App::$pager['page'] == 1 && $j['records'] == 0 && strpos($search,'@')) {
goaway(z_root() . '/chanview/?f=&address=' . $search);
}
info( t("No entries (some entries may be hidden).") . EOL);
@ -479,22 +482,19 @@ class Directory extends Controller {
static public function reorder_results($results,$suggests) {
// return $results;
if(! $suggests)
if (! $suggests) {
return $results;
}
$out = [];
foreach($suggests as $k => $v) {
foreach($results as $rv) {
if($k == $rv['address']) {
foreach ($suggests as $k => $v) {
foreach ($results as $rv) {
if ($k == $rv['address']) {
$out[intval($v)] = $rv;
break;
}
}
}
return $out;
}

View file

@ -353,7 +353,7 @@ class Dirsearch extends Controller {
$ret['results'] = $entries;
if ($kw) {
$k = dir_tagadelic($kw, $hub, $type);
$k = dir_tagadelic($kw, $hub, $type,$safesql);
if ($k) {
$ret['keywords'] = array();
foreach ($k as $kv) {

View file

@ -1,19 +1,23 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
require_once("include/bbcode.php");
require_once('include/security.php');
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Hq extends \Zotlabs\Web\Controller {
class Hq extends Controller {
function init() {
if(! local_channel())
return;
\App::$profile_uid = local_channel();
App::$profile_uid = local_channel();
}
function post() {
@ -104,7 +108,7 @@ class Hq extends \Zotlabs\Web\Controller {
}
if(! $update) {
$channel = \App::get_channel();
$channel = App::get_channel();
$channel_acl = [
'allow_cid' => $channel['channel_allow_cid'],
@ -119,7 +123,7 @@ class Hq extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => populate_acl($channel_acl,true, PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@ -165,7 +169,7 @@ class Hq extends \Zotlabs\Web\Controller {
$o .= "<script> var profile_uid = " . local_channel()
. "; var netargs = '?f='; var profile_page = " . \App::$pager['page'] . ";</script>\r\n";
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),[
App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),[
'$baseurl' => z_root(),
'$pgtype' => 'hq',
'$uid' => local_channel(),

View file

@ -1,11 +1,15 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Web\Controller;
use Zotlabs\Lib\PermissionDescription;
require_once('include/conversation.php');
require_once('include/acl_selectors.php');
class Pubstream extends \Zotlabs\Web\Controller {
class Pubstream extends Controller {
function get($update = 0, $load = false) {
@ -51,7 +55,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
if(local_channel() && (! $update)) {
$channel = \App::get_channel();
$channel = App::get_channel();
$channel_acl = array(
'allow_cid' => $channel['channel_allow_cid'],
@ -66,7 +70,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
'default_location' => $channel['channel_location'],
'nickname' => $channel['channel_address'],
'lockstate' => (($group || $cid || $channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'),
'acl' => populate_acl($channel_acl,true, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'acl' => populate_acl($channel_acl,true,PermissionDescription::fromGlobalPermission('view_stream'), get_post_aclDialogDescription(), 'acl_dialog_post'),
'permissions' => $channel_acl,
'bang' => '',
'visitor' => true,
@ -105,14 +109,14 @@ class Pubstream extends \Zotlabs\Web\Controller {
$o .= '<div id="live-pubstream"></div>' . "\r\n";
$o .= "<script> var profile_uid = " . ((intval(local_channel())) ? local_channel() : (-1))
. "; var profile_page = " . \App::$pager['page']
. "; var profile_page = " . App::$pager['page']
. "; divmore_height = " . intval($maxheight) . "; </script>\r\n";
//if we got a decoded hash we must encode it again before handing to javascript
if($decoded)
$mid = 'b64.' . base64url_encode($mid);
\App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
App::$page['htmlhead'] .= replace_macros(get_markup_template("build_query.tpl"),array(
'$baseurl' => z_root(),
'$pgtype' => 'pubstream',
'$uid' => ((local_channel()) ? local_channel() : '0'),
@ -130,7 +134,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
'$wall' => '0',
'$list' => '0',
'$static' => $static,
'$page' => ((\App::$pager['page'] != 1) ? \App::$pager['page'] : 1),
'$page' => ((App::$pager['page'] != 1) ? App::$pager['page'] : 1),
'$search' => '',
'$xchan' => '',
'$order' => 'comment',
@ -150,8 +154,8 @@ class Pubstream extends \Zotlabs\Web\Controller {
$pager_sql = '';
}
else {
\App::set_pager_itemspage(20);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']), intval(\App::$pager['start']));
App::set_pager_itemspage(20);
$pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(App::$pager['itemspage']), intval(App::$pager['start']));
}
require_once('include/channel.php');
@ -164,7 +168,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$sys = get_sys_channel();
$uids = " and item.uid = " . intval($sys['channel_id']) . " ";
$sql_extra = item_permissions_sql($sys['channel_id']);
\App::$data['firehose'] = intval($sys['channel_id']);
App::$data['firehose'] = intval($sys['channel_id']);
}
if(get_config('system','public_list_mode'))
@ -180,7 +184,7 @@ class Pubstream extends \Zotlabs\Web\Controller {
$net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : '');
$net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : '');
$abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " ";
$abook_uids = " and abook.abook_channel = " . intval(App::$profile['profile_uid']) . " ";
$simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : '');

View file

@ -2,7 +2,7 @@
namespace Zotlabs\Thumbs;
use \ID3Parser\ID3Parser;
use ID3Parser\ID3Parser;
class Mp3audio {

View file

@ -2,6 +2,9 @@
namespace Zotlabs\Widget;
use App;
class Activity_filter {
function widget($arr) {
@ -9,11 +12,23 @@ class Activity_filter {
if(! local_channel())
return '';
$cmd = \App::$cmd;
$cmd = App::$cmd;
$filter_active = false;
$tabs = [];
if(x($_GET,'dm')) {
$dm_active = (($_GET['dm'] == 1) ? 'active' : '');
$filter_active = 'dm';
}
$tabs[] = [
'label' => t('Direct Messages'),
'icon' => 'envelope-o',
'url' => z_root() . '/' . $cmd . '/?dm=1',
'sel' => $dm_active,
'title' => t('Show direct (private) messages')
];
if(x($_GET,'conv')) {
$conv_active = (($_GET['conv'] == 1) ? 'active' : '');
@ -28,6 +43,7 @@ class Activity_filter {
'title' => t('Show posts that mention or involve me')
];
if(x($_GET,'verb')) {
$verb_active = (($_GET['verb'] == 1) ? 'active' : '');
$filter_active = 'events';
@ -41,6 +57,7 @@ class Activity_filter {
'title' => t('Show posts that include events')
];
if(feature_enabled(local_channel(),'star_posts')) {
if(x($_GET,'star')) {
$starred_active = (($_GET['star'] == 1) ? 'active' : '');

View file

@ -258,7 +258,7 @@ function oembed_fetch_url($embedurl){
$j['html'] = purify_html($j['html'],$allow_position);
if($j['html'] != $orig) {
logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j['html'], LOGGER_DEBUG, LOG_INFO);
// logger('oembed html was purified. original: ' . $orig . ' purified: ' . $j['html'], LOGGER_DEBUG, LOG_INFO);
}
$orig_len = mb_strlen(preg_replace('/\s+/','',$orig));

View file

@ -376,7 +376,7 @@ function pub_tagadelic($net,$site,$limit,$recent,$safemode,$type) {
}
function dir_tagadelic($count = 0, $hub = '', $type = 0) {
function dir_tagadelic($count = 0, $hub = '', $type = 0, $safe = '') {
$count = intval($count);
@ -397,8 +397,8 @@ function dir_tagadelic($count = 0, $hub = '', $type = 0) {
);
}
else {
$r = q("select xtag_term as term, count(xtag_term) as total from xtag where xtag_flags = 0
$sql_extra
$r = q("select xtag_term as term, count(xtag_term) as total from xtag left join xchan on xtag_hash = xchan_hash where xtag_flags = 0
$sql_extra $safe
group by xtag_term order by total desc %s",
((intval($count)) ? "limit $count" : '')
);