Merge remote-tracking branch 'mike/master' into dev
This commit is contained in:
commit
dcacdd23c8
@ -542,7 +542,7 @@ class Item extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
// Look for tags and linkify them
|
// Look for tags and linkify them
|
||||||
$results = linkify_tags($a, $body, ($uid) ? $uid : $profile_uid);
|
$results = linkify_tags($a, $body, ($uid) ? $uid : $profile_uid);
|
||||||
|
|
||||||
if($results) {
|
if($results) {
|
||||||
|
|
||||||
// Set permissions based on tag replacements
|
// Set permissions based on tag replacements
|
||||||
|
@ -296,10 +296,11 @@ class Like extends \Zotlabs\Web\Controller {
|
|||||||
notice( t('Permission denied') . EOL);
|
notice( t('Permission denied') . EOL);
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
|
$r = q("select * from xchan where xchan_hash = '%s' limit 1",
|
||||||
dbesc($item['owner_xchan'])
|
dbesc($item['owner_xchan'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r)
|
if($r)
|
||||||
$thread_owner = $r[0];
|
$thread_owner = $r[0];
|
||||||
else
|
else
|
||||||
|
@ -193,26 +193,18 @@ require_once('include/api_zot.php');
|
|||||||
$redirect = trim($_REQUEST['redirect_uris'][0]);
|
$redirect = trim($_REQUEST['redirect_uris'][0]);
|
||||||
else
|
else
|
||||||
$redirect = trim($_REQUEST['redirect_uris']);
|
$redirect = trim($_REQUEST['redirect_uris']);
|
||||||
|
$grant_types = trim($_REQUEST['grant_types']);
|
||||||
|
$scope = trim($_REQUEST['scope']);
|
||||||
$icon = trim($_REQUEST['logo_uri']);
|
$icon = trim($_REQUEST['logo_uri']);
|
||||||
if($oauth2) {
|
$r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
|
||||||
$r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
|
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s' ) ",
|
||||||
VALUES ( '%s', '%s', '%s', null, null, null ) ",
|
dbesc($key),
|
||||||
dbesc($key),
|
dbesc($secret),
|
||||||
dbesc($secret),
|
dbesc($redirect),
|
||||||
dbesc($redirect)
|
dbesc($grant_types),
|
||||||
);
|
dbesc($scope),
|
||||||
}
|
dbesc((string) api_user())
|
||||||
else {
|
);
|
||||||
$r = q("INSERT INTO clients (client_id, pw, clname, redirect_uri, icon, uid)
|
|
||||||
VALUES ('%s','%s','%s','%s','%s',%d)",
|
|
||||||
dbesc($key),
|
|
||||||
dbesc($secret),
|
|
||||||
dbesc($name),
|
|
||||||
dbesc($redirect),
|
|
||||||
dbesc($icon),
|
|
||||||
intval(0)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
$ret['client_id'] = $key;
|
$ret['client_id'] = $key;
|
||||||
$ret['client_secret'] = $secret;
|
$ret['client_secret'] = $secret;
|
||||||
|
@ -780,10 +780,16 @@ function parseIdentityAwareHTML($Text) {
|
|||||||
|
|
||||||
function bbcode($Text, $options = []) {
|
function bbcode($Text, $options = []) {
|
||||||
|
|
||||||
|
if(! is_array($options)) {
|
||||||
|
$options = [];
|
||||||
|
}
|
||||||
|
|
||||||
$preserve_nl = ((array_key_exists('preserve_nl',$options)) ? $options['preserve_nl'] : false);
|
$preserve_nl = ((array_key_exists('preserve_nl',$options)) ? $options['preserve_nl'] : false);
|
||||||
$tryoembed = ((array_key_exists('tryoembed',$options)) ? $options['tryoembed'] : true);
|
$tryoembed = ((array_key_exists('tryoembed',$options)) ? $options['tryoembed'] : true);
|
||||||
$cache = ((array_key_exists('cache',$options)) ? $options['cache'] : false);
|
$cache = ((array_key_exists('cache',$options)) ? $options['cache'] : false);
|
||||||
|
$newwin = ((array_key_exists('newwin',$options)) ? $options['newwin'] : true);
|
||||||
|
|
||||||
|
$target = (($newwin) ? ' target="_blank" ' : '');
|
||||||
|
|
||||||
call_hooks('bbcode_filter', $Text);
|
call_hooks('bbcode_filter', $Text);
|
||||||
|
|
||||||
@ -934,7 +940,7 @@ function bbcode($Text, $options = []) {
|
|||||||
if($tryoembed) {
|
if($tryoembed) {
|
||||||
$Text = preg_replace_callback("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", 'tryoembed', $Text);
|
$Text = preg_replace_callback("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", 'tryoembed', $Text);
|
||||||
}
|
}
|
||||||
$Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", '$1<a href="$2" target="_blank" rel="nofollow noopener">$2</a>', $Text);
|
$Text = preg_replace("/([^\]\='".'"'."\/]|^|\#\^)(https?\:\/\/$urlchars+)/ismu", '$1<a href="$2" ' . $target . ' rel="nofollow noopener">$2</a>', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($Text,'[/share]') !== false) {
|
if (strpos($Text,'[/share]') !== false) {
|
||||||
@ -946,16 +952,16 @@ function bbcode($Text, $options = []) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (strpos($Text,'[/url]') !== false) {
|
if (strpos($Text,'[/url]') !== false) {
|
||||||
$Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\#\^\[url\]([$URLSearchString]*)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
$Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" target="_blank" rel="nofollow noopener" >$2</a>', $Text);
|
$Text = preg_replace("/\#\^\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<span class="bookmark-identifier">#^</span><a class="bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
|
||||||
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[url\]([$URLSearchString]*)\[\/url\]/ism", '<a href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
$Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" target="_blank" rel="nofollow noopener" >$2</a>', $Text);
|
$Text = preg_replace("/\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '<a href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
|
||||||
}
|
}
|
||||||
if (strpos($Text,'[/zrl]') !== false) {
|
if (strpos($Text,'[/zrl]') !== false) {
|
||||||
$Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\#\^\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
$Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" target="_blank" rel="nofollow noopener" >$2</a>', $Text);
|
$Text = preg_replace("/\#\^\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<span class="bookmark-identifier">#^</span><a class="zrl bookmark" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
|
||||||
$Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[zrl\]([$URLSearchString]*)\[\/zrl\]/ism", '<a class="zrl" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" target="_blank" rel="nofollow noopener" >$2</a>', $Text);
|
$Text = preg_replace("/\[zrl\=([$URLSearchString]*)\](.*?)\[\/zrl\]/ism", '<a class="zrl" href="$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (get_account_techlevel() < 2)
|
if (get_account_techlevel() < 2)
|
||||||
@ -963,8 +969,8 @@ function bbcode($Text, $options = []) {
|
|||||||
|
|
||||||
// Perform MAIL Search
|
// Perform MAIL Search
|
||||||
if (strpos($Text,'[/mail]') !== false) {
|
if (strpos($Text,'[/mail]') !== false) {
|
||||||
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[mail\]([$MAILSearchString]*)\[\/mail\]/", '<a href="mailto:$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1" target="_blank" rel="nofollow noopener" >$2</a>', $Text);
|
$Text = preg_replace("/\[mail\=([$MAILSearchString]*)\](.*?)\[\/mail\]/", '<a href="mailto:$1" ' . $target . ' rel="nofollow noopener" >$2</a>', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1286,29 +1292,19 @@ function bbcode($Text, $options = []) {
|
|||||||
|
|
||||||
// if video couldn't be embedded, link to it instead.
|
// if video couldn't be embedded, link to it instead.
|
||||||
if (strpos($Text,'[/video]') !== false) {
|
if (strpos($Text,'[/video]') !== false) {
|
||||||
$Text = preg_replace("/\[video\](.*?)\[\/video\]/", '<a href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[video\](.*?)\[\/video\]/", '<a href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
}
|
}
|
||||||
if (strpos($Text,'[/audio]') !== false) {
|
if (strpos($Text,'[/audio]') !== false) {
|
||||||
$Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '<a href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[audio\](.*?)\[\/audio\]/", '<a href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strpos($Text,'[/zvideo]') !== false) {
|
if (strpos($Text,'[/zvideo]') !== false) {
|
||||||
$Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '<a class="zid" href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[zvideo\](.*?)\[\/zvideo\]/", '<a class="zid" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
}
|
}
|
||||||
if (strpos($Text,'[/zaudio]') !== false) {
|
if (strpos($Text,'[/zaudio]') !== false) {
|
||||||
$Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '<a class="zid" href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
$Text = preg_replace("/\[zaudio\](.*?)\[\/zaudio\]/", '<a class="zid" href="$1" ' . $target . ' rel="nofollow noopener" >$1</a>', $Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if ($tryoembed){
|
|
||||||
// if (strpos($Text,'[/iframe]') !== false) {
|
|
||||||
// $Text = preg_replace_callback("/\[iframe\](.*?)\[\/iframe\]/ism", 'bb_iframe', $Text);
|
|
||||||
// }
|
|
||||||
// } else {
|
|
||||||
// if (strpos($Text,'[/iframe]') !== false) {
|
|
||||||
// $Text = preg_replace("/\[iframe\](.*?)\[\/iframe\]/ism", '<a href="$1" target="_blank" rel="nofollow noopener" >$1</a>', $Text);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// oembed tag
|
// oembed tag
|
||||||
$Text = oembed_bbcode2html($Text);
|
$Text = oembed_bbcode2html($Text);
|
||||||
|
|
||||||
|
@ -780,7 +780,7 @@ function identity_basic_export($channel_id, $sections = null) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(in_array('channel',$sections)) {
|
if(in_array('channel',$sections) || in_array('profile',$sections)) {
|
||||||
$r = q("select * from profile where uid = %d",
|
$r = q("select * from profile where uid = %d",
|
||||||
intval($channel_id)
|
intval($channel_id)
|
||||||
);
|
);
|
||||||
|
@ -1607,7 +1607,7 @@ function prepare_page($item) {
|
|||||||
// prepare_body calls unobscure() as a side effect. Do it here so that
|
// prepare_body calls unobscure() as a side effect. Do it here so that
|
||||||
// the template will get passed an unobscured title.
|
// the template will get passed an unobscured title.
|
||||||
|
|
||||||
$body = prepare_body($item, true);
|
$body = prepare_body($item, [ 'newwin' => false ]);
|
||||||
if(App::$page['template'] == 'none') {
|
if(App::$page['template'] == 'none') {
|
||||||
$tpl = 'page_display_empty.tpl';
|
$tpl = 'page_display_empty.tpl';
|
||||||
|
|
||||||
|
@ -306,7 +306,7 @@ function store_doc_file($s) {
|
|||||||
|
|
||||||
require_once('include/html2plain.php');
|
require_once('include/html2plain.php');
|
||||||
|
|
||||||
$item['body'] = html2plain(prepare_text(file_get_contents($s),$mimetype, true));
|
$item['body'] = html2plain(prepare_text(file_get_contents($s),$mimetype, [ 'cache' => true ]));
|
||||||
$item['mimetype'] = 'text/plain';
|
$item['mimetype'] = 'text/plain';
|
||||||
|
|
||||||
$item['plink'] = z_root() . '/' . str_replace('doc','help',$s);
|
$item['plink'] = z_root() . '/' . str_replace('doc','help',$s);
|
||||||
|
@ -1588,7 +1588,7 @@ function generate_named_map($location) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function prepare_body(&$item,$attach = false) {
|
function prepare_body(&$item,$attach = false,$opts = false) {
|
||||||
|
|
||||||
call_hooks('prepare_body_init', $item);
|
call_hooks('prepare_body_init', $item);
|
||||||
|
|
||||||
@ -1616,7 +1616,7 @@ function prepare_body(&$item,$attach = false) {
|
|||||||
$s .= prepare_binary($item);
|
$s .= prepare_binary($item);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$s .= prepare_text($item['body'],$item['mimetype'], false);
|
$s .= prepare_text($item['body'],$item['mimetype'], $opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : false);
|
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event_obj($item['obj']) : false);
|
||||||
@ -1698,7 +1698,8 @@ function prepare_binary($item) {
|
|||||||
*
|
*
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
|
function prepare_text($text, $content_type = 'text/bbcode', $opts = false) {
|
||||||
|
|
||||||
|
|
||||||
switch($content_type) {
|
switch($content_type) {
|
||||||
case 'text/plain':
|
case 'text/plain':
|
||||||
@ -1742,7 +1743,7 @@ function prepare_text($text, $content_type = 'text/bbcode', $cache = false) {
|
|||||||
if(stristr($text,'[nosmile]'))
|
if(stristr($text,'[nosmile]'))
|
||||||
$s = bbcode($text, [ 'cache' => $cache ]);
|
$s = bbcode($text, [ 'cache' => $cache ]);
|
||||||
else
|
else
|
||||||
$s = smilies(bbcode($text, [ 'cache' => $cache ]));
|
$s = smilies(bbcode($text, ((is_array($opts)) ? $opts : [] )));
|
||||||
|
|
||||||
$s = zidify_links($s);
|
$s = zidify_links($s);
|
||||||
|
|
||||||
@ -2576,6 +2577,9 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
|
|||||||
|
|
||||||
// The @! tag will alter permissions
|
// The @! tag will alter permissions
|
||||||
$exclusive = (((! $grouptag) && (strpos($tag,'!') === 1) && (! $diaspora)) ? true : false);
|
$exclusive = (((! $grouptag) && (strpos($tag,'!') === 1) && (! $diaspora)) ? true : false);
|
||||||
|
if(($grouptag) && (strpos($tag,'!!') === 0)) {
|
||||||
|
$exclusive = true;
|
||||||
|
}
|
||||||
|
|
||||||
//is it already replaced?
|
//is it already replaced?
|
||||||
if(strpos($tag,'[zrl='))
|
if(strpos($tag,'[zrl='))
|
||||||
@ -2748,8 +2752,8 @@ function handle_tag($a, &$body, &$access_tag, &$str_tags, $profile_uid, $tag, $d
|
|||||||
$profile = str_replace(',','%2c',$profile);
|
$profile = str_replace(',','%2c',$profile);
|
||||||
$url = $profile;
|
$url = $profile;
|
||||||
if($grouptag) {
|
if($grouptag) {
|
||||||
$newtag = '!' . '[zrl=' . $profile . ']' . $newname . '[/zrl]';
|
$newtag = '!' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]';
|
||||||
$body = str_replace('!' . $name, $newtag, $body);
|
$body = str_replace('!' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . (($forum && ! $trailing_plus_name) ? '+' : '') . '[/zrl]';
|
$newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . (($forum && ! $trailing_plus_name) ? '+' : '') . '[/zrl]';
|
||||||
@ -2799,6 +2803,7 @@ function linkify_tags($a, &$body, $uid, $diaspora = false) {
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : App::$profile_uid , $tag, $diaspora);
|
$success = handle_tag($a, $body, $access_tag, $str_tags, ($uid) ? $uid : App::$profile_uid , $tag, $diaspora);
|
||||||
|
|
||||||
$results[] = array('success' => $success, 'access_tag' => $access_tag);
|
$results[] = array('success' => $success, 'access_tag' => $access_tag);
|
||||||
if($success['replaced']) $tagged[] = $tag;
|
if($success['replaced']) $tagged[] = $tag;
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ function string2bb(element) {
|
|||||||
|
|
||||||
// Autocomplete forums
|
// Autocomplete forums
|
||||||
forums = {
|
forums = {
|
||||||
match: /(^|\s)(\!)([^ \n]+)$/,
|
match: /(^|\s)(\!\!*)([^ \n]+)$/,
|
||||||
index: 3,
|
index: 3,
|
||||||
search: function(term, callback) { contact_search(term, callback, backend_url, 'f', extra_channels, spinelement=false); },
|
search: function(term, callback) { contact_search(term, callback, backend_url, 'f', extra_channels, spinelement=false); },
|
||||||
replace: editor_replace,
|
replace: editor_replace,
|
||||||
|
Reference in New Issue
Block a user