This commit is contained in:
zotlabs
2019-07-28 20:00:14 -07:00
24 changed files with 495 additions and 332 deletions

View File

@@ -3722,13 +3722,12 @@ function drop_item($id,$interactive = true,$stage = DROPITEM_NORMAL) {
if(! $interactive)
$ok_to_delete = true;
// owner deletion
if(local_channel() && local_channel() == $item['uid'])
// admin deletion
if(is_site_admin())
$ok_to_delete = true;
// sys owned item, requires site admin to delete
$sys = get_sys_channel();
if(is_site_admin() && $sys['channel_id'] == $item['uid'])
// owner deletion
if(local_channel() && local_channel() == $item['uid'])
$ok_to_delete = true;
// author deletion

View File

@@ -1183,12 +1183,12 @@ function discover_by_webbie($webbie, $protocol = '') {
*/
function webfinger_rfc7033($webbie, $zot = false) {
if(strpos($webbie,'@')) {
if(filter_var($webbie, FILTER_VALIDATE_EMAIL)) {
$lhs = substr($webbie,0,strpos($webbie,'@'));
$rhs = substr($webbie,strpos($webbie,'@')+1);
$resource = urlencode('acct:' . $webbie);
}
else {
elseif(filter_var($webbie, FILTER_VALIDATE_URL)) {
$m = parse_url($webbie);
if($m) {
if($m['scheme'] !== 'https')
@@ -1197,9 +1197,10 @@ function webfinger_rfc7033($webbie, $zot = false) {
$rhs = $m['host'] . (($m['port']) ? ':' . $m['port'] : '');
$resource = urlencode($webbie);
}
else
return false;
}
else
return false;
logger('fetching url from resource: ' . $rhs . ':' . $webbie);
$counter = 0;
@@ -1217,7 +1218,7 @@ function webfinger_rfc7033($webbie, $zot = false) {
function old_webfinger($webbie) {
$host = '';
if(strstr($webbie,'@'))
if(filter_var($webbie, FILTER_VALIDATE_EMAIL))
$host = substr($webbie,strpos($webbie,'@') + 1);
if(strlen($host)) {

View File

@@ -1572,7 +1572,9 @@ function format_hashtags(&$item) {
$term = htmlspecialchars($t['term'], ENT_COMPAT, 'UTF-8', false) ;
if(! trim($term))
continue;
if($t['url'] && strpos($item['body'], $t['url']))
if(empty($t['url']))
continue;
if(strpos($item['body'], $t['url']) || strpos($item['body'], '#' . $t['term']))
continue;
if($s)
$s .= ' ';
@@ -2456,8 +2458,8 @@ function magic_link($s) {
* @param boolean $escape (optional) default false
*/
function stringify_array_elms(&$arr, $escape = false) {
for($x = 0; $x < count($arr); $x ++)
$arr[$x] = "'" . (($escape) ? dbesc($arr[$x]) : $arr[$x]) . "'";
foreach($arr as $k => $v)
$arr[$k] = "'" . (($escape) ? dbesc($v) : $v) . "'";
}