Merge remote-tracking branch 'mike/master' into dev
This commit is contained in:
commit
2108173e74
@ -30,8 +30,8 @@ class File_upload extends \Zotlabs\Web\Controller {
|
||||
|
||||
$_REQUEST['allow_cid'] = perms2str($_REQUEST['contact_allow']);
|
||||
$_REQUEST['allow_gid'] = perms2str($_REQUEST['group_allow']);
|
||||
$_REQUEST['deny_cid'] = perms2str($_REQUEST['contact_deny']);
|
||||
$_REQUEST['deny_gid'] = perms2str($_REQUEST['group_deny']);
|
||||
$_REQUEST['deny_cid'] = perms2str($_REQUEST['contact_deny']);
|
||||
$_REQUEST['deny_gid'] = perms2str($_REQUEST['group_deny']);
|
||||
|
||||
if($_REQUEST['filename']) {
|
||||
$r = attach_mkdir($channel, get_observer_hash(), $_REQUEST);
|
||||
@ -47,6 +47,50 @@ class File_upload extends \Zotlabs\Web\Controller {
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
$matches = [];
|
||||
$partial = false;
|
||||
|
||||
|
||||
|
||||
if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
|
||||
$pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
|
||||
if($pm) {
|
||||
// logger('Content-Range: ' . print_r($matches,true));
|
||||
$partial = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($partial) {
|
||||
$x = save_chunk($channel,$matches[1],$matches[2],$matches[3]);
|
||||
if($x['partial']) {
|
||||
header('Range: bytes=0-' . (($x['length']) ? $x['length'] - 1 : 0));
|
||||
json_return_and_die($result);
|
||||
}
|
||||
else {
|
||||
header('Range: bytes=0-' . (($x['size']) ? $x['size'] - 1 : 0));
|
||||
|
||||
$_FILES['userfile'] = [
|
||||
'name' => $x['name'],
|
||||
'type' => $x['type'],
|
||||
'tmp_name' => $x['tmp_name'],
|
||||
'error' => $x['error'],
|
||||
'size' => $x['size']
|
||||
];
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(! array_key_exists('userfile',$_FILES)) {
|
||||
$_FILES['userfile'] = [
|
||||
'name' => $_FILES['files']['name'],
|
||||
'type' => $_FILES['files']['type'],
|
||||
'tmp_name' => $_FILES['files']['tmp_name'],
|
||||
'error' => $_FILES['files']['error'],
|
||||
'size' => $_FILES['files']['size']
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
$r = attach_store($channel, get_observer_hash(), '', $_REQUEST);
|
||||
if($r['success']) {
|
||||
$sync = attach_export_data($channel,$r['data']['hash']);
|
||||
|
@ -103,6 +103,11 @@ class Filestorage extends \Zotlabs\Web\Controller {
|
||||
|
||||
attach_delete($owner, $f['hash']);
|
||||
|
||||
$sync = attach_export_data($channel, $f['hash'], true);
|
||||
if($sync) {
|
||||
build_sync_packet($channel['channel_id'], array('file' => array($sync)));
|
||||
}
|
||||
|
||||
goaway(dirname($url));
|
||||
}
|
||||
|
||||
|
@ -109,7 +109,7 @@ class Profile extends \Zotlabs\Web\Controller {
|
||||
'title' => 'oembed'
|
||||
]);
|
||||
|
||||
$o .= advanced_profile($a);
|
||||
$o .= advanced_profile();
|
||||
call_hooks('profile_advanced',$o);
|
||||
return $o;
|
||||
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
namespace Zotlabs\Module\Settings;
|
||||
|
||||
require_once('include/selectors.php');
|
||||
|
||||
|
||||
class Channel {
|
||||
|
||||
@ -148,7 +150,8 @@ class Channel {
|
||||
$defpermcat = ((x($_POST,'defpermcat')) ? notags(trim($_POST['defpermcat'])) : 'default');
|
||||
|
||||
$cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0);
|
||||
$mailhost = ((array_key_exists('mailhost',$_POST)) ? notags(trim($_POST['mailhost'])) : '');
|
||||
$mailhost = ((array_key_exists('mailhost',$_POST)) ? notags(trim($_POST['mailhost'])) : '');
|
||||
$profile_assign = ((x($_POST,'profile_assign')) ? notags(trim($_POST['profile_assign'])) : '');
|
||||
|
||||
|
||||
$pageflags = $channel['channel_pageflags'];
|
||||
@ -242,6 +245,7 @@ class Channel {
|
||||
set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day);
|
||||
set_pconfig(local_channel(),'system','default_permcat',$defpermcat);
|
||||
set_pconfig(local_channel(),'system','email_notify_host',$mailhost);
|
||||
set_pconfig(local_channel(),'system','profile_assign',$profile_assign);
|
||||
|
||||
$r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d",
|
||||
dbesc($username),
|
||||
@ -515,6 +519,9 @@ class Channel {
|
||||
'$permissions' => t('Default Privacy Group'),
|
||||
'$permdesc' => t("\x28click to open/close\x29"),
|
||||
'$aclselect' => populate_acl($perm_defaults, false, \Zotlabs\Lib\PermissionDescription::fromDescription(t('Use my default audience setting for the type of object published'))),
|
||||
'$profseltxt' => t('Profile to assign new connections'),
|
||||
'$profselect' => ((feature_enabled(local_channel(),'multi_profiles')) ? contact_profile_assign(get_pconfig(local_channel(),'system','profile_assign','')) : ''),
|
||||
|
||||
'$allow_cid' => acl2json($perm_defaults['allow_cid']),
|
||||
'$allow_gid' => acl2json($perm_defaults['allow_gid']),
|
||||
'$deny_cid' => acl2json($perm_defaults['deny_cid']),
|
||||
|
@ -41,10 +41,12 @@ class Wall_attach extends \Zotlabs\Web\Controller {
|
||||
$matches = [];
|
||||
$partial = false;
|
||||
|
||||
$x = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
|
||||
if($x) {
|
||||
// logger('Content-Range: ' . print_r($matches,true));
|
||||
$partial = true;
|
||||
if(array_key_exists('HTTP_CONTENT_RANGE',$_SERVER)) {
|
||||
$pm = preg_match('/bytes (\d*)\-(\d*)\/(\d*)/',$_SERVER['HTTP_CONTENT_RANGE'],$matches);
|
||||
if($pm) {
|
||||
// logger('Content-Range: ' . print_r($matches,true));
|
||||
$partial = true;
|
||||
}
|
||||
}
|
||||
|
||||
if($partial) {
|
||||
|
@ -707,10 +707,12 @@ function parseIdentityAwareHTML($Text) {
|
||||
return $Text;
|
||||
}
|
||||
|
||||
// BBcode 2 HTML was written by WAY2WEB.net
|
||||
// extended to work with Mistpark/Friendica/Redmatrix/Hubzilla - Mike Macgirvin
|
||||
|
||||
function bbcode($Text, $preserve_nl = false, $tryoembed = true, $cache = false) {
|
||||
function bbcode($Text, $options = []) {
|
||||
|
||||
$preserve_nl = ((array_key_exists('preserve_nl',$options)) ? $options['preserve_nl'] : false);
|
||||
$tryoembed = ((array_key_exists('tryomebed',$options)) ? $options['tryoembed'] : true);
|
||||
$cache = ((array_key_exists('cache',$options)) ? $options['cache'] : false);
|
||||
|
||||
|
||||
call_hooks('bbcode_filter', $Text);
|
||||
|
@ -1490,7 +1490,7 @@ function gender_icon($gender) {
|
||||
}
|
||||
|
||||
|
||||
function advanced_profile(&$a) {
|
||||
function advanced_profile() {
|
||||
require_once('include/text.php');
|
||||
if(! perm_is_allowed(App::$profile['profile_uid'],get_observer_hash(),'view_profile'))
|
||||
return '';
|
||||
|
@ -72,21 +72,22 @@ function categories_widget($baseurl,$selected = '') {
|
||||
$item_normal = item_normal();
|
||||
|
||||
$terms = array();
|
||||
$r = q("select distinct(term.term)
|
||||
from term join item on term.oid = item.id
|
||||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.ttype = %d
|
||||
and term.otype = %d
|
||||
and item.owner_xchan = '%s'
|
||||
and item.item_wall = 1
|
||||
$item_normal
|
||||
$sql_extra
|
||||
order by term.term asc",
|
||||
$r = q("select distinct(term.term) from term join item on term.oid = item.id
|
||||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.ttype = %d
|
||||
and term.otype = %d
|
||||
and item.owner_xchan = '%s'
|
||||
and item.item_wall = 1
|
||||
and item.verb != '%s'
|
||||
$item_normal
|
||||
$sql_extra
|
||||
order by term.term asc",
|
||||
intval(App::$profile['profile_uid']),
|
||||
intval(TERM_CATEGORY),
|
||||
intval(TERM_OBJ_POST),
|
||||
dbesc(App::$profile['channel_hash'])
|
||||
intval(TERM_CATEGORY),
|
||||
intval(TERM_OBJ_POST),
|
||||
dbesc(App::$profile['channel_hash']),
|
||||
dbesc(ACTIVITY_UPDATE)
|
||||
);
|
||||
if($r && count($r)) {
|
||||
foreach($r as $rr)
|
||||
@ -118,19 +119,19 @@ function cardcategories_widget($baseurl,$selected = '') {
|
||||
|
||||
$terms = array();
|
||||
$r = q("select distinct(term.term)
|
||||
from term join item on term.oid = item.id
|
||||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.ttype = %d
|
||||
from term join item on term.oid = item.id
|
||||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.ttype = %d
|
||||
and term.otype = %d
|
||||
and item.owner_xchan = '%s'
|
||||
and item.owner_xchan = '%s'
|
||||
$item_normal
|
||||
$sql_extra
|
||||
order by term.term asc",
|
||||
order by term.term asc",
|
||||
intval(App::$profile['profile_uid']),
|
||||
intval(TERM_CATEGORY),
|
||||
intval(TERM_CATEGORY),
|
||||
intval(TERM_OBJ_POST),
|
||||
dbesc(App::$profile['channel_hash'])
|
||||
dbesc(App::$profile['channel_hash'])
|
||||
);
|
||||
if($r && count($r)) {
|
||||
foreach($r as $rr)
|
||||
@ -163,19 +164,19 @@ function articlecategories_widget($baseurl,$selected = '') {
|
||||
|
||||
$terms = array();
|
||||
$r = q("select distinct(term.term)
|
||||
from term join item on term.oid = item.id
|
||||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.ttype = %d
|
||||
from term join item on term.oid = item.id
|
||||
where item.uid = %d
|
||||
and term.uid = item.uid
|
||||
and term.ttype = %d
|
||||
and term.otype = %d
|
||||
and item.owner_xchan = '%s'
|
||||
and item.owner_xchan = '%s'
|
||||
$item_normal
|
||||
$sql_extra
|
||||
order by term.term asc",
|
||||
order by term.term asc",
|
||||
intval(App::$profile['profile_uid']),
|
||||
intval(TERM_CATEGORY),
|
||||
intval(TERM_CATEGORY),
|
||||
intval(TERM_OBJ_POST),
|
||||
dbesc(App::$profile['channel_hash'])
|
||||
dbesc(App::$profile['channel_hash'])
|
||||
);
|
||||
if($r && count($r)) {
|
||||
foreach($r as $rr)
|
||||
|
@ -226,6 +226,8 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
|
||||
|
||||
}
|
||||
|
||||
$profile_assign = get_pconfig($uid,'system','profile_assign','');
|
||||
|
||||
|
||||
$r = q("select abook_id, abook_xchan, abook_pending, abook_instance from abook
|
||||
where abook_xchan = '%s' and abook_channel = %d limit 1",
|
||||
@ -265,6 +267,7 @@ function new_contact($uid,$url,$channel,$interactive = false, $confirm = false)
|
||||
'abook_channel' => intval($uid),
|
||||
'abook_closeness' => intval($closeness),
|
||||
'abook_xchan' => $xchan_hash,
|
||||
'abook_profile' => $profile_assign,
|
||||
'abook_feed' => intval(($xchan['xchan_network'] === 'rss') ? 1 : 0),
|
||||
'abook_created' => datetime_convert(),
|
||||
'abook_updated' => datetime_convert(),
|
||||
|
@ -1749,6 +1749,22 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
||||
intval($arr['uid'])
|
||||
);
|
||||
|
||||
// perhaps the system channel owns the post and it's a pubstream item
|
||||
|
||||
if(! $r) {
|
||||
$s = q("select channel_id from channel where channel_system = 1 limit 1");
|
||||
if($s) {
|
||||
$r = q("SELECT * FROM item WHERE mid = '%s' AND uid = %d ORDER BY id ASC LIMIT 1",
|
||||
dbesc($arr['parent_mid']),
|
||||
intval($s[0]['channel_id'])
|
||||
);
|
||||
}
|
||||
if($r) {
|
||||
$arr['uid'] = $r[0]['uid'];
|
||||
$arr['aid'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if($r) {
|
||||
|
||||
// in case item_store was killed before the parent's parent attribute got set,
|
||||
|
@ -204,7 +204,7 @@ function bb_to_markdown($Text, $options = []) {
|
||||
$Text = $x['bbcode'];
|
||||
|
||||
// Convert it to HTML - don't try oembed
|
||||
$Text = bbcode($Text, $preserve_nl, false);
|
||||
$Text = bbcode($Text, [ 'tryoembed' => false ]);
|
||||
|
||||
// Markdownify does not preserve previously escaped html entities such as <> and &.
|
||||
$Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
|
||||
|
@ -55,18 +55,20 @@ function term_item_parent_query($uid,$table,$s,$type = TERM_UNKNOWN, $type2 = ''
|
||||
$s = str_replace('*','%',$s);
|
||||
|
||||
if($type2) {
|
||||
$r = q("select parent from item left join term on term.oid = item.id where term.ttype in (%d, %d) and term.term like '%s' and term.uid = %d and term.otype = 1",
|
||||
$r = q("select parent from item left join term on term.oid = item.id where term.ttype in (%d, %d) and term.term like '%s' and term.uid = %d and term.otype = 1 and item.verb != '%s'",
|
||||
intval($type),
|
||||
intval($type2),
|
||||
dbesc($s),
|
||||
intval($uid)
|
||||
intval($uid),
|
||||
dbesc(ACTIVITY_UPDATE)
|
||||
);
|
||||
}
|
||||
else {
|
||||
$r = q("select parent from item left join term on term.oid = item.id where term.ttype = %d and term.term like '%s' and term.uid = %d and term.otype = 1",
|
||||
$r = q("select parent from item left join term on term.oid = item.id where term.ttype = %d and term.term like '%s' and term.uid = %d and term.otype = 1 and item.verb != '%s'",
|
||||
intval($type),
|
||||
dbesc($s),
|
||||
intval($uid)
|
||||
intval($uid),
|
||||
dbesc(ACTIVITY_UPDATE)
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1679,9 +1679,9 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
|
||||
require_once('include/bbcode.php');
|
||||
|
||||
if(stristr($text,'[nosmile]'))
|
||||
$s = bbcode($text,false,true,$cache);
|
||||
$s = bbcode($text, [ 'cache' => $cache ]);
|
||||
else
|
||||
$s = smilies(bbcode($text,false,true,$cache));
|
||||
$s = smilies(bbcode($text, [ 'cache' => $cache ]));
|
||||
|
||||
$s = zidify_links($s);
|
||||
|
||||
|
@ -394,6 +394,7 @@ function zot_refresh($them, $channel = null, $force = false) {
|
||||
$next_birthday = NULL_DATE;
|
||||
}
|
||||
|
||||
$profile_assign = get_pconfig($channel['channel_id'],'system','profile_assign','');
|
||||
|
||||
// Keep original perms to check if we need to notify them
|
||||
$previous_perms = get_all_perms($channel['channel_id'],$x['hash']);
|
||||
@ -455,6 +456,7 @@ function zot_refresh($them, $channel = null, $force = false) {
|
||||
'abook_channel' => intval($channel['channel_id']),
|
||||
'abook_closeness' => intval($closeness),
|
||||
'abook_xchan' => $x['hash'],
|
||||
'abook_profile' => $profile_assign,
|
||||
'abook_created' => datetime_convert(),
|
||||
'abook_updated' => datetime_convert(),
|
||||
'abook_dob' => $next_birthday,
|
||||
|
@ -167,6 +167,10 @@
|
||||
</div>
|
||||
<div id="miscellaneous-settings-collapse" class="collapse" role="tabpanel" aria-labelledby="miscellaneous-settings">
|
||||
<div class="section-content-tools-wrapper">
|
||||
{{if $profselect}}
|
||||
<label for="contact-profile-selector">{{$profseltxt}}</label>
|
||||
{{$profselect}}
|
||||
{{/if}}
|
||||
{{if $menus}}
|
||||
<div class="form-group channel-menu">
|
||||
<label for="channel_menu">{{$menu_desc}}</label>
|
||||
|
Reference in New Issue
Block a user