commit
c2989cc8db
|
@ -1838,6 +1838,16 @@
|
|||
|
||||
return($entities);
|
||||
}
|
||||
function api_format_items_embeded_images($item, $text){
|
||||
$a = get_app();
|
||||
$text = preg_replace_callback(
|
||||
"|data:image/([^;]+)[^=]+=*|m",
|
||||
function($match) use ($a, $item) {
|
||||
return $a->get_baseurl()."/display/".$item['guid'];
|
||||
},
|
||||
$text);
|
||||
return $text;
|
||||
}
|
||||
|
||||
function api_format_items($r,$user_info, $filter_user = false) {
|
||||
|
||||
|
@ -1897,6 +1907,9 @@
|
|||
$html = bbcode(api_clean_plain_items($item['body']), false, false, 2, true);
|
||||
$statusbody = trim(html2plain($html, 0));
|
||||
|
||||
// handle data: images
|
||||
$statusbody = api_format_items_embeded_images($item,$statusbody);
|
||||
|
||||
$statustitle = trim($item['title']);
|
||||
|
||||
if (($statustitle != '') and (strpos($statusbody, $statustitle) !== false))
|
||||
|
@ -1907,6 +1920,9 @@
|
|||
if (($item["network"] == NETWORK_FEED) and (strlen($statustext)> 1000))
|
||||
$statustext = substr($statustext, 0, 1000)."... \n".$item["plink"];
|
||||
|
||||
$statushtml = trim(bbcode($item['body'], false, false));
|
||||
|
||||
|
||||
$status = array(
|
||||
'text' => $statustext,
|
||||
'truncated' => False,
|
||||
|
@ -1924,7 +1940,7 @@
|
|||
//'attachments' => array(),
|
||||
'user' => $status_user ,
|
||||
//'entities' => NULL,
|
||||
'statusnet_html' => trim(bbcode($item['body'], false, false)),
|
||||
'statusnet_html' => $statushtml,
|
||||
'statusnet_conversation_id' => $item['parent'],
|
||||
);
|
||||
|
||||
|
@ -2246,13 +2262,6 @@
|
|||
function api_direct_messages_box(&$a, $type, $box) {
|
||||
if (api_user()===false) return false;
|
||||
|
||||
unset($_REQUEST["user_id"]);
|
||||
unset($_GET["user_id"]);
|
||||
|
||||
unset($_REQUEST["screen_name"]);
|
||||
unset($_GET["screen_name"]);
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
|
||||
// params
|
||||
$count = (x($_GET,'count')?$_GET['count']:20);
|
||||
|
@ -2262,11 +2271,25 @@
|
|||
$since_id = (x($_REQUEST,'since_id')?$_REQUEST['since_id']:0);
|
||||
$max_id = (x($_REQUEST,'max_id')?$_REQUEST['max_id']:0);
|
||||
|
||||
$start = $page*$count;
|
||||
$user_id = (x($_REQUEST,'user_id')?$_REQUEST['user_id']:"");
|
||||
$screen_name = (x($_REQUEST,'screen_name')?$_REQUEST['screen_name']:"");
|
||||
|
||||
// caller user info
|
||||
unset($_REQUEST["user_id"]);
|
||||
unset($_GET["user_id"]);
|
||||
|
||||
unset($_REQUEST["screen_name"]);
|
||||
unset($_GET["screen_name"]);
|
||||
|
||||
$user_info = api_get_user($a);
|
||||
//$profile_url = $a->get_baseurl() . '/profile/' . $a->user['nickname'];
|
||||
$profile_url = $user_info["url"];
|
||||
|
||||
|
||||
// pagination
|
||||
$start = $page*$count;
|
||||
|
||||
// filters
|
||||
if ($box=="sentbox") {
|
||||
$sql_extra = "`mail`.`from-url`='".dbesc( $profile_url )."'";
|
||||
}
|
||||
|
@ -2283,12 +2306,20 @@
|
|||
if ($max_id > 0)
|
||||
$sql_extra .= ' AND `mail`.`id` <= '.intval($max_id);
|
||||
|
||||
if ($user_id !="") {
|
||||
$sql_extra .= ' AND `mail`.`contact-id` = ' . intval($user_id);
|
||||
}
|
||||
elseif($screen_name !=""){
|
||||
$sql_extra .= " AND `contact`.`nick` = '" . dbesc($screen_name). "'";
|
||||
}
|
||||
|
||||
$r = q("SELECT `mail`.*, `contact`.`nurl` AS `contact-url` FROM `mail`,`contact` WHERE `mail`.`contact-id` = `contact`.`id` AND `mail`.`uid`=%d AND $sql_extra AND `mail`.`id` > %d ORDER BY `mail`.`id` DESC LIMIT %d,%d",
|
||||
intval(api_user()),
|
||||
intval($since_id),
|
||||
intval($start), intval($count)
|
||||
);
|
||||
|
||||
|
||||
$ret = Array();
|
||||
foreach($r as $item) {
|
||||
if ($box == "inbox" || $item['from-url'] != $profile_url){
|
||||
|
@ -2298,6 +2329,7 @@
|
|||
elseif ($box == "sentbox" || $item['from-url'] == $profile_url){
|
||||
$recipient = api_get_user($a,normalise_link($item['contact-url']));
|
||||
$sender = $user_info;
|
||||
|
||||
}
|
||||
$ret[]=api_format_messages($item, $recipient, $sender);
|
||||
}
|
||||
|
@ -2396,9 +2428,6 @@
|
|||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function api_share_as_retweet($a, $uid, &$item) {
|
||||
$body = trim($item["body"]);
|
||||
|
||||
|
|
Loading…
Reference in a new issue