more stuff we don't need.
This commit is contained in:
parent
ef22c1a9b3
commit
5248c5075d
@ -265,11 +265,6 @@ function construct_activity_object($item) {
|
|||||||
$o .= '<title>' . xmlify($r->title) . '</title>' . "\r\n";
|
$o .= '<title>' . xmlify($r->title) . '</title>' . "\r\n";
|
||||||
if($r->link) {
|
if($r->link) {
|
||||||
if(substr($r->link,0,1) === '<') {
|
if(substr($r->link,0,1) === '<') {
|
||||||
// patch up some facebook "like" activity objects that got stored incorrectly
|
|
||||||
// for a couple of months prior to 9-Jun-2011 and generated bad XML.
|
|
||||||
// we can probably remove this hack here and in the following function in a few months time.
|
|
||||||
if(strstr($r->link,'&') && (! strstr($r->link,'&')))
|
|
||||||
$r->link = str_replace('&','&', $r->link);
|
|
||||||
$r->link = preg_replace('/\<link(.*?)\"\>/','<link$1"/>',$r->link);
|
$r->link = preg_replace('/\<link(.*?)\"\>/','<link$1"/>',$r->link);
|
||||||
$o .= $r->link;
|
$o .= $r->link;
|
||||||
}
|
}
|
||||||
@ -325,16 +320,12 @@ function construct_activity_target($item) {
|
|||||||
if(! function_exists('limit_body_size')) {
|
if(! function_exists('limit_body_size')) {
|
||||||
function limit_body_size($body) {
|
function limit_body_size($body) {
|
||||||
|
|
||||||
logger('limit_body_size: start', LOGGER_DEBUG);
|
|
||||||
|
|
||||||
$maxlen = get_max_import_size();
|
$maxlen = get_max_import_size();
|
||||||
|
|
||||||
// If the length of the body, including the embedded images, is smaller
|
// If the length of the body, including the embedded images, is smaller
|
||||||
// than the maximum, then don't waste time looking for the images
|
// than the maximum, then don't waste time looking for the images
|
||||||
if($maxlen && (strlen($body) > $maxlen)) {
|
if($maxlen && (strlen($body) > $maxlen)) {
|
||||||
|
|
||||||
logger('limit_body_size: the total body length exceeds the limit', LOGGER_DEBUG);
|
|
||||||
|
|
||||||
$orig_body = $body;
|
$orig_body = $body;
|
||||||
$new_body = '';
|
$new_body = '';
|
||||||
$textlen = 0;
|
$textlen = 0;
|
||||||
@ -370,7 +361,6 @@ function limit_body_size($body) {
|
|||||||
|
|
||||||
if( ($textlen + $img_end) > $maxlen ) {
|
if( ($textlen + $img_end) > $maxlen ) {
|
||||||
if($textlen < $maxlen) {
|
if($textlen < $maxlen) {
|
||||||
logger('limit_body_size: the limit happens before the end of a non-embedded image', LOGGER_DEBUG);
|
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
@ -392,13 +382,11 @@ function limit_body_size($body) {
|
|||||||
|
|
||||||
if( ($textlen + strlen($orig_body)) > $maxlen) {
|
if( ($textlen + strlen($orig_body)) > $maxlen) {
|
||||||
if($textlen < $maxlen) {
|
if($textlen < $maxlen) {
|
||||||
logger('limit_body_size: the limit happens after the end of the last image', LOGGER_DEBUG);
|
|
||||||
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
$new_body = $new_body . substr($orig_body, 0, $maxlen - $textlen);
|
||||||
$textlen = $maxlen;
|
$textlen = $maxlen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger('limit_body_size: the text size with embedded images extracted did not violate the limit', LOGGER_DEBUG);
|
|
||||||
$new_body = $new_body . $orig_body;
|
$new_body = $new_body . $orig_body;
|
||||||
$textlen += strlen($orig_body);
|
$textlen += strlen($orig_body);
|
||||||
}
|
}
|
||||||
@ -948,8 +936,7 @@ function item_store($arr,$force_parent = false) {
|
|||||||
// Shouldn't happen but we want to make absolutely sure it doesn't leak from a plugin.
|
// Shouldn't happen but we want to make absolutely sure it doesn't leak from a plugin.
|
||||||
|
|
||||||
if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false))
|
if((strpos($arr['body'],'<') !== false) || (strpos($arr['body'],'>') !== false))
|
||||||
$arr['body'] = strip_tags($arr['body']);
|
$arr['body'] = escape_tags($arr['body']);
|
||||||
|
|
||||||
|
|
||||||
$arr['aid'] = ((x($arr,'aid')) ? intval($arr['aid']) : 0);
|
$arr['aid'] = ((x($arr,'aid')) ? intval($arr['aid']) : 0);
|
||||||
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string());
|
$arr['uri'] = ((x($arr,'uri')) ? notags(trim($arr['uri'])) : random_string());
|
||||||
@ -1109,9 +1096,9 @@ function item_store($arr,$force_parent = false) {
|
|||||||
intval($arr['uid'])
|
intval($arr['uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if(count($r)) {
|
if($r && count($r)) {
|
||||||
$current_post = $r[0]['id'];
|
$current_post = $r[0]['id'];
|
||||||
logger('item_store: created item ' . $current_post);
|
logger('item_store: created item ' . $current_post, LOGGER_DEBUG);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
logger('item_store: could not locate created item');
|
logger('item_store: could not locate created item');
|
||||||
@ -1155,6 +1142,8 @@ function item_store($arr,$force_parent = false) {
|
|||||||
$arr['deny_gid'] = $deny_gid;
|
$arr['deny_gid'] = $deny_gid;
|
||||||
$arr['private'] = $private;
|
$arr['private'] = $private;
|
||||||
|
|
||||||
|
// Store taxonomy
|
||||||
|
|
||||||
if(($terms) && (is_array($terms))) {
|
if(($terms) && (is_array($terms))) {
|
||||||
foreach($terms as $t) {
|
foreach($terms as $t) {
|
||||||
q("insert into term (uid,oid,otype,type,term,url)
|
q("insert into term (uid,oid,otype,type,term,url)
|
||||||
@ -1207,12 +1196,15 @@ function tag_deliver($uid,$item_id) {
|
|||||||
|
|
||||||
$mention = false;
|
$mention = false;
|
||||||
|
|
||||||
$u = q("select * from user where uid = %d limit 1",
|
$u = q("select * from channel where channel_id = %d limit 1",
|
||||||
intval($uid)
|
intval($uid)
|
||||||
);
|
);
|
||||||
if(! count($u))
|
if(! count($u))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
// fixme - look for permissions allowing tag delivery
|
||||||
|
|
||||||
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
$community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
|
||||||
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
|
$prvgroup = (($u[0]['page-flags'] == PAGE_PRVGROUP) ? true : false);
|
||||||
|
|
||||||
@ -1253,6 +1245,7 @@ function tag_deliver($uid,$item_id) {
|
|||||||
);
|
);
|
||||||
$photo = (($r && count($r)) ? $r[0]['thumb'] : $item['author-avatar']);
|
$photo = (($r && count($r)) ? $r[0]['thumb'] : $item['author-avatar']);
|
||||||
|
|
||||||
|
// fixme for channels
|
||||||
|
|
||||||
require_once('include/enotify.php');
|
require_once('include/enotify.php');
|
||||||
notification(array(
|
notification(array(
|
||||||
|
Reference in New Issue
Block a user