merge from upsream 3.8.6 release
This commit is contained in:
+23
-21
@@ -2625,28 +2625,30 @@ function tag_deliver($uid, $item_id) {
|
||||
$plustagged = false;
|
||||
$matches = array();
|
||||
|
||||
$pattern = '/[\!@]\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'],'/') . '\[\/zrl\]/';
|
||||
$pattern = '/[\!@]\!?\[[uz]rl\=' . preg_quote($term['url'],'/') . '\](.*?)\[\/[uz]rl\]/';
|
||||
if(preg_match($pattern,$body,$matches))
|
||||
$tagged = true;
|
||||
|
||||
// original red forum tagging sequence @forumname+
|
||||
$pattern = '/\[url\=' . preg_quote($term['url'],'/') . '\]\@(.*?)\[\/url\]/';
|
||||
if(preg_match($pattern,$body,$matches))
|
||||
$tagged = true;
|
||||
|
||||
|
||||
// standard forum tagging sequence !forumname
|
||||
|
||||
$pluspattern = '/@\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/';
|
||||
$forumpattern = '/\!\!?\[[uz]rl\=([^\]]*?)\]((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/';
|
||||
|
||||
$forumpattern = '/\!\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\[\/zrl\]/';
|
||||
$forumpattern2 = '/\[[uz]rl\=([^\]]*?)\]\!((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/';
|
||||
|
||||
$found = false;
|
||||
|
||||
$matches = array();
|
||||
|
||||
if(preg_match_all($pluspattern,$body,$matches,PREG_SET_ORDER)) {
|
||||
if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) {
|
||||
foreach($matches as $match) {
|
||||
$matched_forums ++;
|
||||
if($term['url'] === $match[1] && $term['term'] === $match[2] && intval($term['ttype']) === TERM_MENTION) {
|
||||
if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) {
|
||||
if($matched_forums <= $max_forums) {
|
||||
$plustagged = true;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring');
|
||||
@@ -2654,13 +2656,12 @@ function tag_deliver($uid, $item_id) {
|
||||
}
|
||||
}
|
||||
|
||||
if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) {
|
||||
if(preg_match_all($forumpattern2,$body,$matches,PREG_SET_ORDER)) {
|
||||
foreach($matches as $match) {
|
||||
$matched_forums ++;
|
||||
if($term['url'] === $match[1] && $term['term'] === $match[2] && intval($term['ttype']) === TERM_FORUM) {
|
||||
if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) {
|
||||
if($matched_forums <= $max_forums) {
|
||||
$plustagged = true;
|
||||
$found = true;
|
||||
break;
|
||||
}
|
||||
logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring');
|
||||
@@ -2882,18 +2883,19 @@ function tgroup_check($uid, $item) {
|
||||
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']);
|
||||
|
||||
|
||||
$pluspattern = '/@\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/';
|
||||
|
||||
$forumpattern = '/\!\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\[\/zrl\]/';
|
||||
|
||||
$forumpattern2 = '/\[zrl\=([^\]]*?)\]\!((?:.(?!\[zrl\=))*?)\[\/zrl\]/';
|
||||
|
||||
|
||||
$found = false;
|
||||
|
||||
$matches = array();
|
||||
|
||||
if(preg_match_all($pluspattern,$body,$matches,PREG_SET_ORDER)) {
|
||||
if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) {
|
||||
foreach($matches as $match) {
|
||||
$matched_forums ++;
|
||||
if($term['url'] === $match[1] && $term['term'] === $match[2] && intval($term['ttype']) === TERM_MENTION) {
|
||||
if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) {
|
||||
if($matched_forums <= $max_forums) {
|
||||
$found = true;
|
||||
break;
|
||||
@@ -2903,10 +2905,10 @@ function tgroup_check($uid, $item) {
|
||||
}
|
||||
}
|
||||
|
||||
if(preg_match_all($forumpattern,$body,$matches,PREG_SET_ORDER)) {
|
||||
if(preg_match_all($forumpattern2,$body,$matches,PREG_SET_ORDER)) {
|
||||
foreach($matches as $match) {
|
||||
$matched_forums ++;
|
||||
if($term['url'] === $match[1] && $term['term'] === $match[2] && intval($term['ttype']) === TERM_FORUM) {
|
||||
if($term['url'] === $match[1] && intval($term['ttype']) === TERM_FORUM) {
|
||||
if($matched_forums <= $max_forums) {
|
||||
$found = true;
|
||||
break;
|
||||
@@ -4608,10 +4610,10 @@ function fix_attached_photo_permissions($uid,$xchan_hash,$body,
|
||||
if(! stristr($image,z_root() . '/photo/'))
|
||||
continue;
|
||||
$image_uri = substr($image,strrpos($image,'/') + 1);
|
||||
if(strpos($image_uri,'-') !== false)
|
||||
$image_uri = substr($image_uri,0, strpos($image_uri,'-'));
|
||||
if(strpos($image_uri,'.') !== false)
|
||||
$image_uri = substr($image_uri,0, strpos($image_uri,'.'));
|
||||
if(strrpos($image_uri,'-') !== false)
|
||||
$image_uri = substr($image_uri,0, strrpos($image_uri,'-'));
|
||||
if(strrpos($image_uri,'.') !== false)
|
||||
$image_uri = substr($image_uri,0, strrpos($image_uri,'.'));
|
||||
if(! strlen($image_uri))
|
||||
continue;
|
||||
$srch = '<' . $xchan_hash . '>';
|
||||
|
||||
+5
-1
@@ -221,7 +221,11 @@ function oembed_fetch_url($embedurl){
|
||||
|
||||
if(strpos(strtolower($embedurl),'.pdf') !== false) {
|
||||
$action = 'allow';
|
||||
$j = [ 'html' => '<object data="' . $embedurl . '" type="application/pdf" width="500" height="720">' . '<a href="' . $embedurl . '">' . t('View PDF') . '</a></object>', 'width' => 500, 'height' => 720, 'type' => 'pdf' ];
|
||||
$j = [
|
||||
'html' => '<object data="' . $embedurl . '" type="application/pdf" style="width: 100%; height: 300px;"></object>',
|
||||
'title' => t('View PDF'),
|
||||
'type' => 'pdf'
|
||||
];
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -31,8 +31,12 @@ class photo_imagick extends photo_driver {
|
||||
if(! $data)
|
||||
return;
|
||||
|
||||
$this->image->readImageBlob($data);
|
||||
|
||||
try {
|
||||
$this->image->readImageBlob($data);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
logger('imagick readImageBlob() exception:' . print_r($e,true));
|
||||
}
|
||||
|
||||
/**
|
||||
* Setup the image to the format it will be saved to
|
||||
@@ -205,4 +209,4 @@ class photo_imagick extends photo_driver {
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
+24
-1
@@ -3225,6 +3225,28 @@ function array2XML($obj, $array) {
|
||||
}
|
||||
}
|
||||
|
||||
function array_path_exists($str,$arr) {
|
||||
|
||||
$ptr = $arr;
|
||||
$search = explode('/', $str);
|
||||
|
||||
if($search) {
|
||||
foreach($search as $s) {
|
||||
if(array_key_exists($s,$ptr)) {
|
||||
$ptr = $ptr[$s];
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Inserts an array into $table.
|
||||
*
|
||||
@@ -3433,7 +3455,7 @@ function get_forum_channels($uid) {
|
||||
|
||||
$sql_extra = (($xf) ? " and ( xchan_hash in (" . $xf . ") or xchan_pubforum = 1 ) " : " and xchan_pubforum = 1 ");
|
||||
|
||||
$r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 and abook_archived = 0 $sql_extra order by xchan_name",
|
||||
$r = q("select abook_id, xchan_hash, xchan_name, xchan_url, xchan_addr, xchan_photo_s from abook left join xchan on abook_xchan = xchan_hash where xchan_deleted = 0 and abook_channel = %d and abook_pending = 0 and abook_ignored = 0 and abook_blocked = 0 and abook_archived = 0 $sql_extra order by xchan_name",
|
||||
intval($uid)
|
||||
);
|
||||
|
||||
@@ -3488,3 +3510,4 @@ function print_val($v) {
|
||||
return $v;
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user