change to bbcode calling parameters: important: will require pulling addons;
also some extra checking of server headers in upload functions
This commit is contained in:
parent
0cfe2ecd7b
commit
a99ebd42ec
@ -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);
|
||||
@ -51,10 +51,14 @@ class File_upload 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) {
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
||||
|
Reference in New Issue
Block a user