Merge remote-tracking branch 'upstream/develop' into setup-rewrite-check

This commit is contained in:
Michael Vogel 2015-06-15 00:55:05 +02:00
commit 0e157b1288
6 changed files with 22 additions and 6 deletions

View file

@ -379,6 +379,7 @@ if(! class_exists('App')) {
public $identities; public $identities;
public $is_mobile; public $is_mobile;
public $is_tablet; public $is_tablet;
public $is_friendica_app;
public $performance = array(); public $performance = array();
public $nav_sel; public $nav_sel;
@ -596,6 +597,9 @@ if(! class_exists('App')) {
$this->is_mobile = $mobile_detect->isMobile(); $this->is_mobile = $mobile_detect->isMobile();
$this->is_tablet = $mobile_detect->isTablet(); $this->is_tablet = $mobile_detect->isTablet();
// Friendica-Client
$this->is_friendica_app = ($_SERVER['HTTP_USER_AGENT'] == "Apache-HttpClient/UNAVAILABLE (java 1.4)");
/** /**
* register template engines * register template engines
*/ */
@ -906,6 +910,10 @@ if(! class_exists('App')) {
return(FRIENDICA_PLATFORM." '".FRIENDICA_CODENAME."' ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION."; ".$this->get_baseurl()); return(FRIENDICA_PLATFORM." '".FRIENDICA_CODENAME."' ".FRIENDICA_VERSION."-".DB_UPDATE_VERSION."; ".$this->get_baseurl());
} }
function is_friendica_app() {
return($this->is_friendica_app);
}
} }
} }

View file

@ -376,7 +376,9 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
} else } else
$item["parent-uri"] = $item["uri"]; $item["parent-uri"] = $item["uri"];
$item_id = item_store($item); // We risk the chance of getting orphan items, we correct it some lines later
// To-Do: See To-Do line below.
$item_id = item_store($item, true);
//echo $xml; //echo $xml;
//print_r($item); //print_r($item);
//echo $item_id." ".$item["parent-uri"]."\n"; //echo $item_id." ".$item["parent-uri"]."\n";
@ -416,6 +418,9 @@ function ostatus_import($xml,$importer,&$contact, &$hub) {
if ($conversation != "") { if ($conversation != "") {
// Check for duplicates. We really don't need to check the same conversation twice. // Check for duplicates. We really don't need to check the same conversation twice.
if (!in_array($conversation, $conversationlist)) { if (!in_array($conversation, $conversationlist)) {
// To-Do:
// Call this before item_store is called to avoid posts with orphans
// The routine then needs to get the item array.
complete_conversation($item_id, $conversation); complete_conversation($item_id, $conversation);
$conversationlist[] = $conversation; $conversationlist[] = $conversation;
} }

View file

@ -18,11 +18,8 @@ function notify_init(&$a) {
intval(local_user()) intval(local_user())
); );
// Friendica-Client
$friendicamobile = ($_SERVER['HTTP_USER_AGENT'] == "Apache-HttpClient/UNAVAILABLE (java 1.4)");
// The friendica client has problems with the GUID. this is some workaround // The friendica client has problems with the GUID. this is some workaround
if ($friendicamobile) { if ($a->is_friendica_app()) {
require_once("include/items.php"); require_once("include/items.php");
$urldata = parse_url($r[0]['link']); $urldata = parse_url($r[0]['link']);
$guid = basename($urldata["path"]); $guid = basename($urldata["path"]);

View file

@ -316,6 +316,8 @@ function ping_get_notifications($uid, $regularnotifications) {
$order = ""; $order = "";
$quit = false; $quit = false;
$a = get_app();
do { do {
$r = q("SELECT `notify`.*, `item`.`visible`, `item`.`spam`, `item`.`deleted` $r = q("SELECT `notify`.*, `item`.`visible`, `item`.`spam`, `item`.`deleted`
FROM `notify` LEFT JOIN `item` ON `item`.`id` = `notify`.`iid` FROM `notify` LEFT JOIN `item` ON `item`.`id` = `notify`.`iid`
@ -354,8 +356,9 @@ function ping_get_notifications($uid, $regularnotifications) {
// Replace the name with {0} but ensure to make that only once // Replace the name with {0} but ensure to make that only once
// The {0} is used later and prints the name in bold. // The {0} is used later and prints the name in bold.
// But don't do it for the android app. // But don't do it for the android app.
$pos = strpos($notification["msg"],$notification['name']); $pos = strpos($notification["msg"],$notification['name']);
if (($pos !== false) AND $regularnotifications) if (($pos !== false) AND $regularnotifications AND !$a->is_friendica_app())
$notification["msg"] = substr_replace($notification["msg"],"{0}",$pos,strlen($notification["name"])); $notification["msg"] = substr_replace($notification["msg"],"{0}",$pos,strlen($notification["name"]));
else else
$notification["msg"] = str_replace("{0}", $notification["name"], $notification["msg"]); $notification["msg"] = str_replace("{0}", $notification["name"], $notification["msg"]);

View file

@ -54,6 +54,7 @@ function xrd_init(&$a) {
'$dspr' => $dspr, '$dspr' => $dspr,
'$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'], '$salmon' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'],
'$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention', '$salmen' => $a->get_baseurl() . '/salmon/' . $r[0]['nickname'] . '/mention',
'$subscribe' => $a->get_baseurl() . '/follow?url={uri}',
'$modexp' => 'data:application/magic-public-key,' . $salmon_key, '$modexp' => 'data:application/magic-public-key,' . $salmon_key,
'$bigkey' => salmon_key($r[0]['pubkey']) '$bigkey' => salmon_key($r[0]['pubkey'])
)); ));

View file

@ -29,6 +29,8 @@
href="{{$salmon}}" /> href="{{$salmon}}" />
<Link rel="http://salmon-protocol.org/ns/salmon-mention" <Link rel="http://salmon-protocol.org/ns/salmon-mention"
href="{{$salmen}}" /> href="{{$salmen}}" />
<Link rel="http://ostatus.org/schema/1.0/subscribe"
template="{{$subscribe}}" />
<Link rel="magic-public-key" <Link rel="magic-public-key"
href="{{$modexp}}" /> href="{{$modexp}}" />