Merge branch 'develop' of github.com:annando/friendica into 1410-remote-self
This commit is contained in:
@@ -1838,7 +1838,17 @@
|
||||
|
||||
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) {
|
||||
|
||||
$a = get_app();
|
||||
@@ -1896,17 +1906,23 @@
|
||||
//$statusbody = trim(html2plain(bbcode(api_clean_plain_items($item['body']), false, false, 5, true), 0));
|
||||
$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))
|
||||
$statustext = trim($statusbody);
|
||||
else
|
||||
$statustext = trim($statustitle."\n\n".$statusbody);
|
||||
|
||||
|
||||
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,11 +2306,19 @@
|
||||
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) {
|
||||
@@ -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"]);
|
||||
|
||||
|
||||
@@ -282,6 +282,11 @@ function relative_date($posted_date,$format = null) {
|
||||
return t('less than a second ago');
|
||||
}
|
||||
|
||||
$time_append = '';
|
||||
if ($etime >= 86400) {
|
||||
$time_append = ' ('.$localtime.')';
|
||||
}
|
||||
|
||||
$a = array( 12 * 30 * 24 * 60 * 60 => array( t('year'), t('years')),
|
||||
30 * 24 * 60 * 60 => array( t('month'), t('months')),
|
||||
7 * 24 * 60 * 60 => array( t('week'), t('weeks')),
|
||||
@@ -298,7 +303,7 @@ function relative_date($posted_date,$format = null) {
|
||||
// translators - e.g. 22 hours ago, 1 minute ago
|
||||
if(! $format)
|
||||
$format = t('%1$d %2$s ago');
|
||||
return sprintf( $format,$r, (($r == 1) ? $str[0] : $str[1]));
|
||||
return sprintf( $format,$r, (($r == 1) ? $str[0] : $str[1])).$time_append;
|
||||
}
|
||||
}
|
||||
}}
|
||||
|
||||
@@ -872,7 +872,7 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
||||
}
|
||||
|
||||
if (isset($contact["network"]) AND ($contact["network"] == NETWORK_FEED) AND $contact['fetch_further_information']) {
|
||||
$res["body"] = $res["title"].add_page_info($res['plink'], false, "", true);
|
||||
$res["body"] = $res["title"].add_page_info($res['plink'], false, "", ($contact['fetch_further_information'] == 2));
|
||||
$res["title"] = "";
|
||||
$res["object-type"] = ACTIVITY_OBJ_BOOKMARK;
|
||||
} elseif (isset($contact["network"]) AND ($contact["network"] == NETWORK_OSTATUS))
|
||||
@@ -888,12 +888,8 @@ function get_atom_elements($feed, $item, $contact = array()) {
|
||||
return $res;
|
||||
}
|
||||
|
||||
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false) {
|
||||
require_once("mod/parse_url.php");
|
||||
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
|
||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
function add_page_info_data($data) {
|
||||
call_hooks('page_info_data', $data);
|
||||
|
||||
// It maybe is a rich content, but if it does have everything that a link has,
|
||||
// then treat it that way
|
||||
@@ -921,7 +917,7 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
|
||||
$text .= "[quote]".$data["text"]."[/quote]";
|
||||
|
||||
$hashtags = "";
|
||||
if ($keywords AND isset($data["keywords"])) {
|
||||
if (isset($data["keywords"]) AND count($data["keywords"])) {
|
||||
$a = get_app();
|
||||
$hashtags = "\n";
|
||||
foreach ($data["keywords"] AS $keyword) {
|
||||
@@ -933,6 +929,21 @@ function add_page_info($url, $no_photos = false, $photo = "", $keywords = false)
|
||||
return("\n[class=type-".$data["type"]."]".$text."[/class]".$hashtags);
|
||||
}
|
||||
|
||||
function add_page_info($url, $no_photos = false, $photo = "", $keywords = false) {
|
||||
require_once("mod/parse_url.php");
|
||||
|
||||
$data = parseurl_getsiteinfo($url, true);
|
||||
|
||||
logger('add_page_info: fetch page info for '.$url.' '.print_r($data, true), LOGGER_DEBUG);
|
||||
|
||||
if (!$keywords AND isset($data["keywords"]))
|
||||
unset($data["keywords"]);
|
||||
|
||||
$text = add_page_info_data($data);
|
||||
|
||||
return($text);
|
||||
}
|
||||
|
||||
function add_page_info_to_body($body, $texturl = false, $no_photos = false) {
|
||||
|
||||
logger('add_page_info_to_body: fetch page info for body '.$body, LOGGER_DEBUG);
|
||||
|
||||
@@ -189,8 +189,8 @@ function create_user($arr) {
|
||||
$spubkey = $sres['pubkey'];
|
||||
|
||||
$r = q("INSERT INTO `user` ( `guid`, `username`, `password`, `email`, `openid`, `nickname`,
|
||||
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class` )
|
||||
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s' )",
|
||||
`pubkey`, `prvkey`, `spubkey`, `sprvkey`, `register_date`, `verified`, `blocked`, `timezone`, `service_class`, `default-location` )
|
||||
VALUES ( '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 'UTC', '%s', '' )",
|
||||
dbesc(generate_user_guid()),
|
||||
dbesc($username),
|
||||
dbesc($new_password_encoded),
|
||||
|
||||
Reference in New Issue
Block a user