Merge branch 'develop' of github.com:annando/friendica into 1410-remote-self
This commit is contained in:
commit
b1cdaefcb2
14 changed files with 6219 additions and 6120 deletions
13
boot.php
13
boot.php
|
@ -522,21 +522,28 @@ if(! class_exists('App')) {
|
|||
if (substr($this->query_string, 0, 1) == "/")
|
||||
$this->query_string = substr($this->query_string, 1);
|
||||
}
|
||||
|
||||
if (x($_GET,'pagename'))
|
||||
$this->cmd = trim($_GET['pagename'],'/\\');
|
||||
elseif (x($_GET,'q'))
|
||||
$this->cmd = trim($_GET['q'],'/\\');
|
||||
|
||||
|
||||
// fix query_string
|
||||
$this->query_string = str_replace($this->cmd."&",$this->cmd."?", $this->query_string);
|
||||
|
||||
|
||||
// unix style "homedir"
|
||||
|
||||
if(substr($this->cmd,0,1) === '~')
|
||||
$this->cmd = 'profile/' . substr($this->cmd,1);
|
||||
$this->cmd = 'profile/' . substr($this->cmd,1);
|
||||
|
||||
// Diaspora style profile url
|
||||
|
||||
if(substr($this->cmd,0,2) === 'u/')
|
||||
$this->cmd = 'profile/' . substr($this->cmd,2);
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
* Break the URL path into C style argc/argv style arguments for our
|
||||
|
@ -609,6 +616,10 @@ if(! class_exists('App')) {
|
|||
return($basepath);
|
||||
}
|
||||
|
||||
function get_scheme() {
|
||||
return($this->scheme);
|
||||
}
|
||||
|
||||
function get_baseurl($ssl = false) {
|
||||
|
||||
$scheme = $this->scheme;
|
||||
|
|
|
@ -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"]);
|
||||
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -53,6 +53,13 @@ if(!$install) {
|
|||
load_config('config');
|
||||
load_config('system');
|
||||
|
||||
if ((intval(get_config('system','ssl_policy')) == SSL_POLICY_FULL) AND
|
||||
($a->get_scheme() == "http") AND
|
||||
(substr($a->get_baseurl(), 0, 8) == "https://")) {
|
||||
header("HTTP/1.1 302 Moved Temporarily");
|
||||
header("location: ".$a->get_baseurl()."/".$a->query_string);
|
||||
}
|
||||
|
||||
require_once("include/session.php");
|
||||
load_hooks();
|
||||
call_hooks('init_1');
|
||||
|
|
|
@ -502,7 +502,8 @@ function contacts_content(&$a) {
|
|||
'$archived' => (($contact['archive']) ? t('Currently archived') : ''),
|
||||
'$hidden' => array('hidden', t('Hide this contact from others'), ($contact['hidden'] == 1), t('Replies/likes to your public posts <strong>may</strong> still be visible')),
|
||||
'$notify' => array('notify', t('Notification for new posts'), ($contact['notify_new_posts'] == 1), t('Send a notification of every new post of this contact')),
|
||||
'$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), ($contact['fetch_further_information'] == 1), t('Fetch further information for feeds')),
|
||||
'$fetch_further_information' => array('fetch_further_information', t('Fetch further information for feeds'), $contact['fetch_further_information'], t('Fetch further information for feeds'),
|
||||
array('0'=>t('Disabled'), '1'=>t('Fetch information'), '2'=>t('Fetch information and keywords'))),
|
||||
'$photo' => $contact['photo'],
|
||||
'$name' => $contact['name'],
|
||||
'$dir_icon' => $dir_icon,
|
||||
|
|
|
@ -648,12 +648,8 @@ function dfrn_request_content(&$a) {
|
|||
|
||||
if(! local_user()) {
|
||||
info( t("Please login to confirm introduction.") . EOL );
|
||||
|
||||
/* setup the return URL to come back to this page if they use openid */
|
||||
|
||||
$stripped = str_replace('q=','',$a->query_string);
|
||||
$_SESSION['return_url'] = trim($stripped,'/');
|
||||
|
||||
$_SESSION['return_url'] = $a->query_string;
|
||||
return login();
|
||||
}
|
||||
|
||||
|
|
10
mod/item.php
10
mod/item.php
|
@ -137,6 +137,7 @@ function item_post(&$a) {
|
|||
$profile_uid = ((x($_REQUEST,'profile_uid')) ? intval($_REQUEST['profile_uid']) : 0);
|
||||
$post_id = ((x($_REQUEST,'post_id')) ? intval($_REQUEST['post_id']) : 0);
|
||||
$app = ((x($_REQUEST,'source')) ? strip_tags($_REQUEST['source']) : '');
|
||||
$extid = ((x($_REQUEST,'extid')) ? strip_tags($_REQUEST['extid']) : '');
|
||||
|
||||
$allow_moderated = false;
|
||||
|
||||
|
@ -200,7 +201,7 @@ function item_post(&$a) {
|
|||
$verb = $orig_post['verb'];
|
||||
$objecttype = $orig_post['object-type'];
|
||||
$emailcc = $orig_post['emailcc'];
|
||||
$app = $orig_post['app'];
|
||||
$app = $orig_post['app'];
|
||||
$categories = $orig_post['file'];
|
||||
$title = notags(trim($_REQUEST['title']));
|
||||
$body = escape_tags(trim($_REQUEST['body']));
|
||||
|
@ -208,6 +209,7 @@ function item_post(&$a) {
|
|||
$pubmail_enable = $orig_post['pubmail'];
|
||||
$network = $orig_post['network'];
|
||||
$guid = $orig_post['guid'];
|
||||
$extid = $orig_post['extid'];
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -652,6 +654,7 @@ function item_post(&$a) {
|
|||
$datarray['commented'] = datetime_convert();
|
||||
$datarray['received'] = datetime_convert();
|
||||
$datarray['changed'] = datetime_convert();
|
||||
$datarray['extid'] = $extid;
|
||||
$datarray['guid'] = $guid;
|
||||
$datarray['uri'] = $uri;
|
||||
$datarray['title'] = $title;
|
||||
|
@ -749,11 +752,12 @@ function item_post(&$a) {
|
|||
$post_id = 0;
|
||||
|
||||
|
||||
$r = q("INSERT INTO `item` (`guid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
||||
$r = q("INSERT INTO `item` (`guid`, `extid`, `uid`,`type`,`wall`,`gravity`, `network`, `contact-id`,`owner-name`,`owner-link`,`owner-avatar`,
|
||||
`author-name`, `author-link`, `author-avatar`, `created`, `edited`, `commented`, `received`, `changed`, `uri`, `thr-parent`, `title`, `body`, `app`, `location`, `coord`,
|
||||
`tag`, `inform`, `verb`, `object-type`, `postopts`, `allow_cid`, `allow_gid`, `deny_cid`, `deny_gid`, `private`, `pubmail`, `attach`, `bookmark`,`origin`, `moderated`, `file` )
|
||||
VALUES( '%s', %d, '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )",
|
||||
VALUES( '%s', '%s', %d, '%s', %d, %d, '%s', %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', %d, %d, %d, '%s' )",
|
||||
dbesc($datarray['guid']),
|
||||
dbesc($datarray['extid']),
|
||||
intval($datarray['uid']),
|
||||
dbesc($datarray['type']),
|
||||
intval($datarray['wall']),
|
||||
|
|
|
@ -16,9 +16,10 @@ function network_init(&$a) {
|
|||
}
|
||||
}
|
||||
|
||||
// convert query string to array and remove first element (which is friendica args)
|
||||
// convert query string to array. remove friendica args
|
||||
$query_array = array();
|
||||
parse_str($a->query_string, $query_array);
|
||||
$query_string = str_replace($a->cmd."?", "", $a->query_string);
|
||||
parse_str($query_string, $query_array);
|
||||
array_shift($query_array);
|
||||
|
||||
// fetch last used network view and redirect if needed
|
||||
|
@ -297,11 +298,11 @@ function network_content(&$a, $update = 0) {
|
|||
|
||||
if(! local_user()) {
|
||||
$_SESSION['return_url'] = $a->query_string;
|
||||
return login(false);
|
||||
return login(false);
|
||||
}
|
||||
|
||||
// TODO:is this really necessary? $a is already available to hooks
|
||||
$arr = array('query' => $a->query_string);
|
||||
|
||||
call_hooks('network_content_init', $arr);
|
||||
|
||||
|
||||
|
|
|
@ -333,6 +333,8 @@ function parseurl_getsiteinfo($url, $no_guessing = false, $do_oembed = true, $co
|
|||
|
||||
logger("parseurl_getsiteinfo: Siteinfo for ".$url." ".print_r($siteinfo, true), LOGGER_DEBUG);
|
||||
|
||||
call_hooks('getsiteinfo', $siteinfo);
|
||||
|
||||
return($siteinfo);
|
||||
}
|
||||
|
||||
|
@ -410,6 +412,13 @@ function parse_url_content(&$a) {
|
|||
|
||||
$siteinfo = parseurl_getsiteinfo($url);
|
||||
|
||||
// if ($textmode) {
|
||||
// require_once("include/items.php");
|
||||
//
|
||||
// echo add_page_info_data($siteinfo);
|
||||
// killme();
|
||||
// }
|
||||
|
||||
$url= $siteinfo["url"];
|
||||
|
||||
$sitedata = "";
|
||||
|
|
12172
util/messages.po
12172
util/messages.po
File diff suppressed because it is too large
Load diff
|
@ -51,6 +51,7 @@ do
|
|||
if [ ! -d "$f" ]
|
||||
then
|
||||
xgettext $KEYWORDS $OPTS -j -o "$OUTFILE" --from-code=UTF-8 "$f"
|
||||
sed -i "s/CHARSET/UTF-8/g" "$OUTFILE"
|
||||
fi
|
||||
done
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@
|
|||
{{/if}}
|
||||
<div id="contact-edit-end" ></div>
|
||||
{{include file="field_checkbox.tpl" field=$notify}}
|
||||
{{include file="field_checkbox.tpl" field=$fetch_further_information}}
|
||||
{{include file="field_select.tpl" field=$fetch_further_information}}
|
||||
{{include file="field_checkbox.tpl" field=$hidden}}
|
||||
|
||||
<div id="contact-edit-info-wrapper">
|
||||
|
|
Loading…
Reference in a new issue