Merge remote-tracking branch 'friendica/develop' into develop

This commit is contained in:
Hypolite Petovan 2017-01-03 09:11:05 +11:00
commit 93ea37e016
20 changed files with 6792 additions and 6568 deletions

View file

@ -38,7 +38,7 @@ define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_CODENAME', 'Asparagus');
define ( 'FRIENDICA_VERSION', '3.5.1-dev' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1209 );
define ( 'DB_UPDATE_VERSION', 1211 );
/**
* @brief Constant with a HTML line break.
@ -809,7 +809,7 @@ class App {
function get_baseurl($ssl = false) {
// Is the function called statically?
if (!is_object($this)) {
if (!(isset($this) && get_class($this) == __CLASS__)) {
return self::$a->get_baseurl($ssl);
}
@ -1053,7 +1053,7 @@ class App {
function remove_baseurl($orig_url){
// Is the function called statically?
if (!is_object($this)) {
if (!(isset($this) && get_class($this) == __CLASS__)) {
return(self::$a->remove_baseurl($orig_url));
}

View file

@ -1,6 +1,6 @@
-- ------------------------------------------
-- Friendica 3.5.1-dev (Asparagus)
-- DB_UPDATE_VERSION 1208
-- DB_UPDATE_VERSION 1211
-- ------------------------------------------
@ -54,11 +54,11 @@ CREATE TABLE IF NOT EXISTS `auth_codes` (
-- TABLE cache
--
CREATE TABLE IF NOT EXISTS `cache` (
`k` varchar(255) NOT NULL,
`k` varbinary(255) NOT NULL,
`v` text,
`expire_mode` int(11) NOT NULL DEFAULT 0,
`updated` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`k`(191)),
PRIMARY KEY(`k`),
INDEX `updated` (`updated`),
INDEX `expire_mode_updated` (`expire_mode`,`updated`)
) DEFAULT CHARSET=utf8mb4;
@ -94,11 +94,11 @@ CREATE TABLE IF NOT EXISTS `clients` (
--
CREATE TABLE IF NOT EXISTS `config` (
`id` int(10) unsigned NOT NULL auto_increment,
`cat` varchar(255) NOT NULL DEFAULT '',
`k` varchar(255) NOT NULL DEFAULT '',
`cat` varbinary(255) NOT NULL DEFAULT '',
`k` varbinary(255) NOT NULL DEFAULT '',
`v` text,
PRIMARY KEY(`id`),
UNIQUE INDEX `cat_k` (`cat`(30),`k`(30))
UNIQUE INDEX `cat_k` (`cat`,`k`)
) DEFAULT CHARSET=utf8mb4;
--
@ -200,7 +200,7 @@ CREATE TABLE IF NOT EXISTS `conv` (
--
CREATE TABLE IF NOT EXISTS `deliverq` (
`id` int(10) unsigned NOT NULL auto_increment,
`cmd` varchar(32) NOT NULL DEFAULT '',
`cmd` varbinary(32) NOT NULL DEFAULT '',
`item` int(11) NOT NULL DEFAULT 0,
`contact` int(11) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
@ -212,6 +212,7 @@ CREATE TABLE IF NOT EXISTS `deliverq` (
--
CREATE TABLE IF NOT EXISTS `event` (
`id` int(11) NOT NULL auto_increment,
`guid` varchar(255) NOT NULL DEFAULT '',
`uid` int(11) NOT NULL DEFAULT 0,
`cid` int(11) NOT NULL DEFAULT 0,
`uri` varchar(255) NOT NULL DEFAULT '',
@ -682,10 +683,10 @@ CREATE TABLE IF NOT EXISTS `notify-threads` (
-- TABLE oembed
--
CREATE TABLE IF NOT EXISTS `oembed` (
`url` varchar(255) NOT NULL,
`url` varbinary(255) NOT NULL,
`content` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`(191)),
PRIMARY KEY(`url`),
INDEX `created` (`created`)
) DEFAULT CHARSET=utf8mb4;
@ -693,12 +694,12 @@ CREATE TABLE IF NOT EXISTS `oembed` (
-- TABLE parsed_url
--
CREATE TABLE IF NOT EXISTS `parsed_url` (
`url` varchar(255) NOT NULL,
`url` varbinary(255) NOT NULL,
`guessing` tinyint(1) NOT NULL DEFAULT 0,
`oembed` tinyint(1) NOT NULL DEFAULT 0,
`content` text,
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`url`(191),`guessing`,`oembed`),
PRIMARY KEY(`url`,`guessing`,`oembed`),
INDEX `created` (`created`)
) DEFAULT CHARSET=utf8mb4;
@ -708,11 +709,11 @@ CREATE TABLE IF NOT EXISTS `parsed_url` (
CREATE TABLE IF NOT EXISTS `pconfig` (
`id` int(11) NOT NULL auto_increment,
`uid` int(11) NOT NULL DEFAULT 0,
`cat` varchar(255) NOT NULL DEFAULT '',
`k` varchar(255) NOT NULL DEFAULT '',
`cat` varbinary(255) NOT NULL DEFAULT '',
`k` varbinary(255) NOT NULL DEFAULT '',
`v` mediumtext,
PRIMARY KEY(`id`),
UNIQUE INDEX `uid_cat_k` (`uid`,`cat`(30),`k`(30))
UNIQUE INDEX `uid_cat_k` (`uid`,`cat`,`k`)
) DEFAULT CHARSET=utf8mb4;
--
@ -786,7 +787,7 @@ CREATE TABLE IF NOT EXISTS `poll_result` (
--
CREATE TABLE IF NOT EXISTS `process` (
`pid` int(10) unsigned NOT NULL,
`command` varchar(32) NOT NULL DEFAULT '',
`command` varbinary(32) NOT NULL DEFAULT '',
`created` datetime NOT NULL DEFAULT '0000-00-00 00:00:00',
PRIMARY KEY(`pid`),
INDEX `command` (`command`)
@ -920,7 +921,7 @@ CREATE TABLE IF NOT EXISTS `search` (
--
CREATE TABLE IF NOT EXISTS `session` (
`id` bigint(20) unsigned NOT NULL auto_increment,
`sid` varchar(255) NOT NULL DEFAULT '',
`sid` varbinary(255) NOT NULL DEFAULT '',
`data` text,
`expire` int(10) unsigned NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),

View file

@ -69,6 +69,28 @@ function diaspora2bb($s) {
return $s;
}
/**
* @brief Callback function to replace a Friendica style mention in a mention for Diaspora
*
* @param array $match Matching values for the callback
* @return text Replaced mention
*/
function diaspora_mentions($match) {
$contact = get_contact_details_by_url($match[3]);
if (!isset($contact['addr'])) {
$contact = Probe::uri($match[3]);
}
if (!isset($contact['addr'])) {
return $match[0];
}
$mention = '@{'.$match[2].'; '.$contact['addr'].'}';
return $mention;
}
function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
$a = get_app();
@ -108,8 +130,8 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
} else
$Text = bbcode($Text, $preserve_nl, false, 4);
// mask some special HTML chars from conversation to markdown
$Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
// mask some special HTML chars from conversation to markdown
$Text = str_replace(array('<','>','&'),array('&_lt_;','&_gt_;','&_amp_;'),$Text);
// If a link is followed by a quote then there should be a newline before it
// Maybe we should make this newline at every time before a quote.
@ -120,8 +142,8 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
// Now convert HTML to Markdown
$Text = new HTML_To_Markdown($Text);
// unmask the special chars back to HTML
$Text = str_replace(array('&_lt_;','&_gt_;','&_amp_;'),array('<','>','&'),$Text);
// unmask the special chars back to HTML
$Text = str_replace(array('&_lt_;','&_gt_;','&_amp_;'),array('<','>','&'),$Text);
$a->save_timestamp($stamp1, "parser");
@ -132,6 +154,11 @@ function bb2diaspora($Text,$preserve_nl = false, $fordiaspora = true) {
// the Diaspora signature verification and cause the item to disappear
$Text = trim($Text);
if ($fordiaspora) {
$URLSearchString = "^\[\]";
$Text = preg_replace_callback("/([@]\[(.*?)\])\(([$URLSearchString]*?)\)/ism", 'diaspora_mentions', $Text);
}
call_hooks('bb2diaspora',$Text);
return $Text;

View file

@ -464,13 +464,13 @@ function db_definition($charset) {
);
$database["cache"] = array(
"fields" => array(
"k" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
"k" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"v" => array("type" => "text"),
"expire_mode" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"updated" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
),
"indexes" => array(
"PRIMARY" => array("k".db_index_suffix($charset)),
"PRIMARY" => array("k"),
"updated" => array("updated"),
"expire_mode_updated" => array("expire_mode", "updated"),
)
@ -504,13 +504,13 @@ function db_definition($charset) {
$database["config"] = array(
"fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"v" => array("type" => "text"),
),
"indexes" => array(
"PRIMARY" => array("id"),
"cat_k" => array("UNIQUE", "cat(30)","k(30)"),
"cat_k" => array("UNIQUE", "cat", "k"),
)
);
$database["contact"] = array(
@ -610,7 +610,7 @@ function db_definition($charset) {
$database["deliverq"] = array(
"fields" => array(
"id" => array("type" => "int(10) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"cmd" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"cmd" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
"item" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"contact" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
),
@ -622,6 +622,7 @@ function db_definition($charset) {
$database["event"] = array(
"fields" => array(
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"guid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"cid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"uri" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
@ -1092,25 +1093,25 @@ function db_definition($charset) {
);
$database["oembed"] = array(
"fields" => array(
"url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
"url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"content" => array("type" => "text"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
),
"indexes" => array(
"PRIMARY" => array("url".db_index_suffix($charset)),
"PRIMARY" => array("url"),
"created" => array("created"),
)
);
$database["parsed_url"] = array(
"fields" => array(
"url" => array("type" => "varchar(255)", "not null" => "1", "primary" => "1"),
"url" => array("type" => "varbinary(255)", "not null" => "1", "primary" => "1"),
"guessing" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"oembed" => array("type" => "tinyint(1)", "not null" => "1", "default" => "0", "primary" => "1"),
"content" => array("type" => "text"),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
),
"indexes" => array(
"PRIMARY" => array("url".db_index_suffix($charset), "guessing", "oembed"),
"PRIMARY" => array("url", "guessing", "oembed"),
"created" => array("created"),
)
);
@ -1118,13 +1119,13 @@ function db_definition($charset) {
"fields" => array(
"id" => array("type" => "int(11)", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"uid" => array("type" => "int(11)", "not null" => "1", "default" => "0"),
"cat" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"cat" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"k" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"v" => array("type" => "mediumtext"),
),
"indexes" => array(
"PRIMARY" => array("id"),
"uid_cat_k" => array("UNIQUE", "uid","cat(30)","k(30)"),
"uid_cat_k" => array("UNIQUE", "uid", "cat", "k"),
)
);
$database["photo"] = array(
@ -1196,7 +1197,7 @@ function db_definition($charset) {
$database["process"] = array(
"fields" => array(
"pid" => array("type" => "int(10) unsigned", "not null" => "1", "primary" => "1"),
"command" => array("type" => "varchar(32)", "not null" => "1", "default" => ""),
"command" => array("type" => "varbinary(32)", "not null" => "1", "default" => ""),
"created" => array("type" => "datetime", "not null" => "1", "default" => "0000-00-00 00:00:00"),
),
"indexes" => array(
@ -1330,7 +1331,7 @@ function db_definition($charset) {
$database["session"] = array(
"fields" => array(
"id" => array("type" => "bigint(20) unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1"),
"sid" => array("type" => "varchar(255)", "not null" => "1", "default" => ""),
"sid" => array("type" => "varbinary(255)", "not null" => "1", "default" => ""),
"data" => array("type" => "text"),
"expire" => array("type" => "int(10) unsigned", "not null" => "1", "default" => "0"),
),

View file

@ -518,15 +518,6 @@ function delivery_run(&$argv, &$argc){
if (!$contact['pubkey'] && !$public_message)
break;
$unsupported_activities = array(ACTIVITY_DISLIKE, ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE);
//don't transmit activities which are not supported by diaspora
foreach($unsupported_activities as $act) {
if (activity_match($target_item['verb'],$act)) {
break 2;
}
}
if (($target_item['deleted']) && (($target_item['uri'] === $target_item['parent-uri']) || $followup)) {
// top-level retraction
logger('diaspora retract: '.$loc);

View file

@ -18,6 +18,7 @@ require_once("include/group.php");
require_once("include/xml.php");
require_once("include/datetime.php");
require_once("include/queue_fn.php");
require_once("include/cache.php");
/**
* @brief This class contain functions to create and send Diaspora XML files
@ -87,7 +88,7 @@ class Diaspora {
*
* @return string the repaired signature
*/
private function repair_signature($signature, $handle = "", $level = 1) {
private static function repair_signature($signature, $handle = "", $level = 1) {
if ($signature == "")
return ($signature);
@ -111,7 +112,7 @@ class Diaspora {
*
* @return string verified data
*/
private function verify_magic_envelope($envelope) {
private static function verify_magic_envelope($envelope) {
$basedom = parse_xml_string($envelope, false);
@ -412,7 +413,7 @@ class Diaspora {
*
* @return bool Is the posting valid?
*/
private function valid_posting($msg, &$fields) {
private static function valid_posting($msg, &$fields) {
$data = parse_xml_string($msg["message"], false);
@ -520,7 +521,7 @@ class Diaspora {
$key = self::key($msg["author"]);
if (!rsa_verify($signed_data, $parent_author_signature, $key, "sha256")) {
logger("No valid parent author signature for author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG);
logger("No valid parent author signature for parent author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$parent_author_signature, LOGGER_DEBUG);
return false;
}
}
@ -528,7 +529,7 @@ class Diaspora {
$key = self::key($fields->author);
if (!rsa_verify($signed_data, $author_signature, $key, "sha256")) {
logger("No valid author signature for author ".$msg["author"]. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG);
logger("No valid author signature for author ".$fields->author. " in type ".$type." - signed data: ".$signed_data." - Message: ".$msg["message"]." - Signature ".$author_signature, LOGGER_DEBUG);
return false;
} else
return true;
@ -541,7 +542,7 @@ class Diaspora {
*
* @return string The public key
*/
private function key($handle) {
private static function key($handle) {
$handle = strval($handle);
logger("Fetching diaspora key for: ".$handle);
@ -560,7 +561,7 @@ class Diaspora {
*
* @return array the queried data
*/
private function person_by_handle($handle) {
private static function person_by_handle($handle) {
$r = q("SELECT * FROM `fcontact` WHERE `network` = '%s' AND `addr` = '%s' LIMIT 1",
dbesc(NETWORK_DIASPORA),
@ -601,7 +602,7 @@ class Diaspora {
*
* @return string The id of the fcontact entry
*/
private function add_fcontact($arr, $update = false) {
private static function add_fcontact($arr, $update = false) {
if($update) {
$r = q("UPDATE `fcontact` SET
@ -734,7 +735,7 @@ class Diaspora {
*
* @return The contact id
*/
private function contact_by_handle($uid, $handle) {
private static function contact_by_handle($uid, $handle) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `addr` = '%s' LIMIT 1",
intval($uid),
dbesc($handle)
@ -765,7 +766,7 @@ class Diaspora {
*
* @return bool is the contact allowed to post?
*/
private function post_allow($importer, $contact, $is_comment = false) {
private static function post_allow($importer, $contact, $is_comment = false) {
// perhaps we were already sharing with this person. Now they're sharing with us.
// That makes us friends.
@ -804,7 +805,7 @@ class Diaspora {
*
* @return array The contact data
*/
private function allowed_contact_by_handle($importer, $handle, $is_comment = false) {
private static function allowed_contact_by_handle($importer, $handle, $is_comment = false) {
$contact = self::contact_by_handle($importer["uid"], $handle);
if (!$contact) {
logger("A Contact for handle ".$handle." and user ".$importer["uid"]." was not found");
@ -826,7 +827,7 @@ class Diaspora {
*
* @return int|bool message id if the message already was stored into the system - or false.
*/
private function message_exists($uid, $guid) {
private static function message_exists($uid, $guid) {
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `guid` = '%s' LIMIT 1",
intval($uid),
dbesc($guid)
@ -845,7 +846,7 @@ class Diaspora {
*
* @param array $item The item array
*/
private function fetch_guid($item) {
private static function fetch_guid($item) {
preg_replace_callback("&\[url=/posts/([^\[\]]*)\](.*)\[\/url\]&Usi",
function ($match) use ($item){
return(self::fetch_guid_sub($match, $item));
@ -890,7 +891,7 @@ class Diaspora {
* @param array $match array containing a link that has to be checked for a message link
* @param array $item The item array
*/
private function fetch_guid_sub($match, $item) {
private static function fetch_guid_sub($match, $item) {
if (!self::store_by_guid($match[1], $item["author-link"]))
self::store_by_guid($match[1], $item["owner-link"]);
}
@ -904,7 +905,7 @@ class Diaspora {
*
* @return int the message id of the stored message or false
*/
private function store_by_guid($guid, $server, $uid = 0) {
private static function store_by_guid($guid, $server, $uid = 0) {
$serverparts = parse_url($server);
$server = $serverparts["scheme"]."://".$serverparts["host"];
@ -933,7 +934,7 @@ class Diaspora {
* 'author' => The author handle
* 'key' => The public key of the author
*/
private function message($guid, $server, $level = 0) {
private static function message($guid, $server, $level = 0) {
if ($level > 5)
return false;
@ -1009,7 +1010,7 @@ class Diaspora {
*
* @return array the item record
*/
private function parent_item($uid, $guid, $author, $contact) {
private static function parent_item($uid, $guid, $author, $contact) {
$r = q("SELECT `id`, `body`, `wall`, `uri`, `private`, `origin`,
`author-name`, `author-link`, `author-avatar`,
`owner-name`, `owner-link`, `owner-avatar`
@ -1055,7 +1056,7 @@ class Diaspora {
* 'cid' => contact id
* 'network' => network type
*/
private function author_contact_by_url($contact, $person, $uid) {
private static function author_contact_by_url($contact, $person, $uid) {
$r = q("SELECT `id`, `network`, `url` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d LIMIT 1",
dbesc(normalise_link($person["url"])), intval($uid));
@ -1093,7 +1094,7 @@ class Diaspora {
*
* @return string the post link
*/
private function plink($addr, $guid) {
private static function plink($addr, $guid) {
$r = q("SELECT `url`, `nick`, `network` FROM `fcontact` WHERE `addr`='%s' LIMIT 1", dbesc($addr));
// Fallback
@ -1123,7 +1124,7 @@ class Diaspora {
*
* @return bool Success
*/
private function receive_account_deletion($importer, $data) {
private static function receive_account_deletion($importer, $data) {
/// @todo Account deletion should remove the contact from the global contacts as well
@ -1145,16 +1146,38 @@ class Diaspora {
*
* @param string $author Author handle
* @param string $guid Message guid
* @param boolean $onlyfound Only return uri when found in the database
*
* @return string The constructed uri or the one from our database
*/
private function get_uri_from_guid($author, $guid) {
private static function get_uri_from_guid($author, $guid, $onlyfound = false) {
$r = q("SELECT `uri` FROM `item` WHERE `guid` = '%s' LIMIT 1", dbesc($guid));
if ($r)
if (dbm::is_result($r)) {
return $r[0]["uri"];
else
} elseif (!$onlyfound) {
return $author.":".$guid;
}
return "";
}
/**
* @brief Fetch the guid from our database with a given uri
*
* @param string $author Author handle
* @param string $uri Message uri
*
* @return string The post guid
*/
private static function get_guid_from_uri($uri, $uid) {
$r = q("SELECT `guid` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", dbesc($uri), intval($uid));
if (dbm::is_result($r)) {
return $r[0]["guid"];
} else {
return false;
}
}
/**
@ -1167,7 +1190,7 @@ class Diaspora {
*
* @return int The message id of the generated comment or "false" if there was an error
*/
private function receive_comment($importer, $sender, $data, $xml) {
private static function receive_comment($importer, $sender, $data, $xml) {
$guid = notags(unxmlify($data->guid));
$parent_guid = notags(unxmlify($data->parent_guid));
$text = unxmlify($data->text);
@ -1179,6 +1202,13 @@ class Diaspora {
$created_at = datetime_convert();
}
if (isset($data->thread_parent_guid)) {
$thread_parent_guid = notags(unxmlify($data->thread_parent_guid));
$thr_uri = self::get_uri_from_guid("", $thread_parent_guid, true);
} else {
$thr_uri = "";
}
$contact = self::allowed_contact_by_handle($importer, $sender, true);
if (!$contact) {
return false;
@ -1223,7 +1253,12 @@ class Diaspora {
$datarray["type"] = "remote-comment";
$datarray["verb"] = ACTIVITY_POST;
$datarray["gravity"] = GRAVITY_COMMENT;
$datarray["parent-uri"] = $parent_item["uri"];
if ($thr_uri != "") {
$datarray["parent-uri"] = $thr_uri;
} else {
$datarray["parent-uri"] = $parent_item["uri"];
}
$datarray["object-type"] = ACTIVITY_OBJ_COMMENT;
$datarray["object"] = $xml;
@ -1271,7 +1306,7 @@ class Diaspora {
*
* @return bool "true" if it was successful
*/
private function receive_conversation_message($importer, $contact, $data, $msg, $mesg, $conversation) {
private static function receive_conversation_message($importer, $contact, $data, $msg, $mesg, $conversation) {
$guid = notags(unxmlify($data->guid));
$subject = notags(unxmlify($data->subject));
$author = notags(unxmlify($data->author));
@ -1396,7 +1431,7 @@ class Diaspora {
*
* @return bool Success
*/
private function receive_conversation($importer, $msg, $data) {
private static function receive_conversation($importer, $msg, $data) {
$guid = notags(unxmlify($data->guid));
$subject = notags(unxmlify($data->subject));
$created_at = datetime_convert("UTC", "UTC", notags(unxmlify($data->created_at)));
@ -1462,7 +1497,7 @@ class Diaspora {
*
* @return string the body
*/
private function construct_like_body($contact, $parent_item, $guid) {
private static function construct_like_body($contact, $parent_item, $guid) {
$bodyverb = t('%1$s likes %2$s\'s %3$s');
$ulink = "[url=".$contact["url"]."]".$contact["name"]."[/url]";
@ -1480,7 +1515,7 @@ class Diaspora {
*
* @return string The XML
*/
private function construct_like_object($importer, $parent_item) {
private static function construct_like_object($importer, $parent_item) {
$objtype = ACTIVITY_OBJ_NOTE;
$link = '<link rel="alternate" type="text/html" href="'.App::get_baseurl()."/display/".$importer["nickname"]."/".$parent_item["id"].'" />';
$parent_body = $parent_item["body"];
@ -1504,7 +1539,7 @@ class Diaspora {
*
* @return int The message id of the generated like or "false" if there was an error
*/
private function receive_like($importer, $sender, $data) {
private static function receive_like($importer, $sender, $data) {
$positive = notags(unxmlify($data->positive));
$guid = notags(unxmlify($data->guid));
$parent_type = notags(unxmlify($data->parent_type));
@ -1601,7 +1636,7 @@ class Diaspora {
*
* @return bool Success?
*/
private function receive_message($importer, $data) {
private static function receive_message($importer, $data) {
$guid = notags(unxmlify($data->guid));
$parent_guid = notags(unxmlify($data->parent_guid));
$text = unxmlify($data->text);
@ -1682,7 +1717,7 @@ class Diaspora {
*
* @return bool always true
*/
private function receive_participation($importer, $data) {
private static function receive_participation($importer, $data) {
// I'm not sure if we can fully support this message type
return true;
}
@ -1695,7 +1730,7 @@ class Diaspora {
*
* @return bool always true
*/
private function receive_photo($importer, $data) {
private static function receive_photo($importer, $data) {
// There doesn't seem to be a reason for this function, since the photo data is transmitted in the status message as well
return true;
}
@ -1708,7 +1743,7 @@ class Diaspora {
*
* @return bool always true
*/
private function receive_poll_participation($importer, $data) {
private static function receive_poll_participation($importer, $data) {
// We don't support polls by now
return true;
}
@ -1721,7 +1756,7 @@ class Diaspora {
*
* @return bool Success
*/
private function receive_profile($importer, $data) {
private static function receive_profile($importer, $data) {
$author = strtolower(notags(unxmlify($data->author)));
$contact = self::contact_by_handle($importer["uid"], $author);
@ -1812,7 +1847,7 @@ class Diaspora {
* @param array $importer Array of the importer user
* @param array $contact The contact that send the request
*/
private function receive_request_make_friend($importer, $contact) {
private static function receive_request_make_friend($importer, $contact) {
$a = get_app();
@ -1881,18 +1916,18 @@ class Diaspora {
*
* @return string The XML
*/
private function construct_new_friend_object($contact) {
$objtype = ACTIVITY_OBJ_PERSON;
$link = '<link rel="alternate" type="text/html" href="'.$contact["url"].'" />'."\n".
'<link rel="photo" type="image/jpeg" href="'.$contact["thumb"].'" />'."\n";
private static function construct_new_friend_object($contact) {
$objtype = ACTIVITY_OBJ_PERSON;
$link = '<link rel="alternate" type="text/html" href="'.$contact["url"].'" />'."\n".
'<link rel="photo" type="image/jpeg" href="'.$contact["thumb"].'" />'."\n";
$xmldata = array("object" => array("type" => $objtype,
"title" => $contact["name"],
"id" => $contact["url"]."/".$contact["name"],
"link" => $link));
$xmldata = array("object" => array("type" => $objtype,
"title" => $contact["name"],
"id" => $contact["url"]."/".$contact["name"],
"link" => $link));
return xml::from_array($xmldata, $xml, true);
}
return xml::from_array($xmldata, $xml, true);
}
/**
* @brief Processes incoming sharing notification
@ -1902,7 +1937,7 @@ class Diaspora {
*
* @return bool Success
*/
private function receive_contact_request($importer, $data) {
private static function receive_contact_request($importer, $data) {
$author = unxmlify($data->author);
$recipient = unxmlify($data->recipient);
@ -2083,7 +2118,7 @@ class Diaspora {
*
* @return array The fetched item
*/
private function original_item($guid, $orig_author, $author) {
private static function original_item($guid, $orig_author, $author) {
// Do we already have this item?
$r = q("SELECT `body`, `tag`, `app`, `created`, `object-type`, `uri`, `guid`,
@ -2154,7 +2189,7 @@ class Diaspora {
*
* @return int the message id
*/
private function receive_reshare($importer, $data, $xml) {
private static function receive_reshare($importer, $data, $xml) {
$root_author = notags(unxmlify($data->root_author));
$root_guid = notags(unxmlify($data->root_guid));
$guid = notags(unxmlify($data->guid));
@ -2233,7 +2268,7 @@ class Diaspora {
*
* @return bool success
*/
private function item_retraction($importer, $contact, $data) {
private static function item_retraction($importer, $contact, $data) {
$target_type = notags(unxmlify($data->target_type));
$target_guid = notags(unxmlify($data->target_guid));
$author = notags(unxmlify($data->author));
@ -2289,7 +2324,7 @@ class Diaspora {
*
* @return bool Success
*/
private function receive_retraction($importer, $sender, $data) {
private static function receive_retraction($importer, $sender, $data) {
$target_type = notags(unxmlify($data->target_type));
$contact = self::contact_by_handle($importer["uid"], $sender);
@ -2331,7 +2366,7 @@ class Diaspora {
*
* @return int The message id of the newly created item
*/
private function receive_status_message($importer, $data, $xml) {
private static function receive_status_message($importer, $data, $xml) {
$raw_message = unxmlify($data->raw_message);
$guid = notags(unxmlify($data->guid));
$author = notags(unxmlify($data->author));
@ -2442,7 +2477,7 @@ class Diaspora {
*
* @return string the handle in the format user@domain.tld
*/
private function my_handle($contact) {
private static function my_handle($contact) {
if ($contact["addr"] != "")
return $contact["addr"];
@ -2501,7 +2536,7 @@ class Diaspora {
*
* @return string The envelope
*/
private function build_public_message($msg, $user, $contact, $prvkey, $pubkey) {
private static function build_public_message($msg, $user, $contact, $prvkey, $pubkey) {
logger("Message: ".$msg, LOGGER_DATA);
@ -2547,7 +2582,7 @@ class Diaspora {
*
* @return string The envelope
*/
private function build_private_message($msg, $user, $contact, $prvkey, $pubkey) {
private static function build_private_message($msg, $user, $contact, $prvkey, $pubkey) {
logger("Message: ".$msg, LOGGER_DATA);
@ -2638,7 +2673,7 @@ class Diaspora {
*
* @return string The message that will be transmitted to other servers
*/
private function build_message($msg, $user, $contact, $prvkey, $pubkey, $public = false) {
private static function build_message($msg, $user, $contact, $prvkey, $pubkey, $public = false) {
if ($public)
$magic_env = self::build_public_message($msg,$user,$contact,$prvkey,$pubkey);
@ -2658,7 +2693,7 @@ class Diaspora {
*
* @return string The signature
*/
private function signature($owner, $message) {
private static function signature($owner, $message) {
$sigmsg = $message;
unset($sigmsg["author_signature"]);
unset($sigmsg["parent_author_signature"]);
@ -2765,7 +2800,7 @@ class Diaspora {
*
* @return int Result of the transmission
*/
private function build_and_transmit($owner, $contact, $type, $message, $public_batch = false, $guid = "", $spool = false) {
private static function build_and_transmit($owner, $contact, $type, $message, $public_batch = false, $guid = "", $spool = false) {
$msg = self::build_post_xml($type, $message);
@ -2906,6 +2941,80 @@ class Diaspora {
return($ret);
}
/**
* @brief Create an event array
*
* @param integer $event_id The id of the event
*
* @return array with event data
*/
private static function build_event($event_id) {
$r = q("SELECT `guid`, `uid`, `start`, `finish`, `nofinish`, `summary`, `desc`, `location`, `adjust` FROM `event` WHERE `id` = %d", intval($event_id));
if (!dbm::is_result($r)) {
return array();
}
$event = $r[0];
$eventdata = array();
$r = q("SELECT `timezone` FROM `user` WHERE `uid` = %d", intval($event['uid']));
if (!dbm::is_result($r)) {
return array();
}
$user = $r[0];
$r = q("SELECT `addr`, `nick` FROM `contact` WHERE `uid` = %d AND `self`", intval($event['uid']));
if (!dbm::is_result($r)) {
return array();
}
$owner = $r[0];
$eventdata['author'] = self::my_handle($owner);
if ($event['guid']) {
$eventdata['guid'] = $event['guid'];
}
$mask = 'Y-m-d\TH:i:s\Z';
/// @todo - establish "all day" events in Friendica
$eventdata["all_day"] = "false";
if (!$event['adjust']) {
$eventdata['timezone'] = $user['timezone'];
if ($eventdata['timezone'] == "") {
$eventdata['timezone'] = 'UTC';
}
}
if ($event['start']) {
$eventdata['start'] = datetime_convert($eventdata['timezone'], "UTC", $event['start'], $mask);
}
if ($event['finish'] AND !$event['nofinish']) {
$eventdata['end'] = datetime_convert($eventdata['timezone'], "UTC", $event['finish'], $mask);
}
if ($event['summary']) {
$eventdata['summary'] = html_entity_decode(bb2diaspora($event['summary']));
}
if ($event['desc']) {
$eventdata['description'] = html_entity_decode(bb2diaspora($event['desc']));
}
if ($event['location']) {
$location = array();
$location["address"] = html_entity_decode(bb2diaspora($event['location']));
$location["lat"] = 0;
$location["lng"] = 0;
$eventdata['location'] = $location;
}
return $eventdata;
}
/**
* @brief Create a post (status message or reshare)
*
@ -2918,11 +3027,18 @@ class Diaspora {
*/
public static function build_status($item, $owner) {
$cachekey = "diaspora:build_status:".$item['guid'];
$result = Cache::get($cachekey);
if (!is_null($result)) {
return $result;
}
$myaddr = self::my_handle($owner);
$public = (($item["private"]) ? "false" : "true");
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d H:i:s \U\T\C');
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
// Detect a share element and do a reshare
if (!$item['private'] AND ($ret = self::is_reshare($item["body"]))) {
@ -2979,9 +3095,24 @@ class Diaspora {
unset($message["location"]);
}
if ($item['event-id'] > 0) {
$event = self::build_event($item['event-id']);
if (count($event)) {
$message['event'] = $event;
/// @todo Once Diaspora supports it, we will remove the body
// $message['raw_message'] = '';
}
}
$type = "status_message";
}
return array("type" => $type, "message" => $message);
$msg = array("type" => $type, "message" => $message);
Cache::set($cachekey, $msg, CACHE_QUARTER_HOUR);
return $msg;
}
/**
@ -3009,7 +3140,7 @@ class Diaspora {
*
* @return array The data for a "like"
*/
private function construct_like($item, $owner) {
private static function construct_like($item, $owner) {
$p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($item["thr-parent"]));
@ -3019,7 +3150,11 @@ class Diaspora {
$parent = $p[0];
$target_type = ($parent["uri"] === $parent["parent-uri"] ? "Post" : "Comment");
$positive = "true";
if ($item['verb'] === ACTIVITY_LIKE) {
$positive = "true";
} elseif ($item['verb'] === ACTIVITY_DISLIKE) {
$positive = "false";
}
return(array("positive" => $positive,
"guid" => $item["guid"],
@ -3029,6 +3164,45 @@ class Diaspora {
"diaspora_handle" => self::my_handle($owner)));
}
/**
* @brief Creates an "EventParticipation" object
*
* @param array $item The item that will be exported
* @param array $owner the array of the item owner
*
* @return array The data for an "EventParticipation"
*/
private static function construct_attend($item, $owner) {
$p = q("SELECT `guid`, `uri`, `parent-uri` FROM `item` WHERE `uri` = '%s' LIMIT 1",
dbesc($item["thr-parent"]));
if (!dbm::is_result($p))
return false;
$parent = $p[0];
switch ($item['verb']) {
case ACTIVITY_ATTEND:
$attend_answer = 'accepted';
break;
case ACTIVITY_ATTENDNO:
$attend_answer = 'declined';
break;
case ACTIVITY_ATTENDMAYBE:
$attend_answer = 'tentative';
break;
default:
logger('Unknown verb '.$item['verb'].' in item '.$item['guid']);
return false;
}
return(array("author" => self::my_handle($owner),
"guid" => $item["guid"],
"parent_guid" => $parent["guid"],
"status" => $attend_answer,
"author_signature" => ""));
}
/**
* @brief Creates the object for a comment
*
@ -3037,7 +3211,14 @@ class Diaspora {
*
* @return array The data for a comment
*/
private function construct_comment($item, $owner) {
private static function construct_comment($item, $owner) {
$cachekey = "diaspora:construct_comment:".$item['guid'];
$result = Cache::get($cachekey);
if (!is_null($result)) {
return $result;
}
$p = q("SELECT `guid` FROM `item` WHERE `parent` = %d AND `id` = %d LIMIT 1",
intval($item["parent"]),
@ -3050,12 +3231,23 @@ class Diaspora {
$parent = $p[0];
$text = html_entity_decode(bb2diaspora($item["body"]));
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
return(array("guid" => $item["guid"],
$comment = array("guid" => $item["guid"],
"parent_guid" => $parent["guid"],
"author_signature" => "",
"text" => $text,
"diaspora_handle" => self::my_handle($owner)));
/// @todo Currently disabled until Diaspora supports it: "created_at" => $created,
"diaspora_handle" => self::my_handle($owner));
// Send the thread parent guid only if it is a threaded comment
if ($item['thr-parent'] != $item['parent-uri']) {
$comment['thread_parent_guid'] = self::get_guid_from_uri($item['thr-parent'], $item['uid']);
}
Cache::set($cachekey, $comment, CACHE_QUARTER_HOUR);
return($comment);
}
/**
@ -3070,7 +3262,10 @@ class Diaspora {
*/
public static function send_followup($item,$owner,$contact,$public_batch = false) {
if($item['verb'] === ACTIVITY_LIKE) {
if (in_array($item['verb'], array(ACTIVITY_ATTEND, ACTIVITY_ATTENDNO, ACTIVITY_ATTENDMAYBE))) {
$message = self::construct_attend($item, $owner);
$type = "event_participation";
} elseif (in_array($item["verb"], array(ACTIVITY_LIKE, ACTIVITY_DISLIKE))) {
$message = self::construct_like($item, $owner);
$type = "like";
} else {
@ -3094,7 +3289,7 @@ class Diaspora {
*
* @return string The message
*/
private function message_from_signature($item, $signature) {
private static function message_from_signature($item, $signature) {
// Split the signed text
$signed_parts = explode(";", $signature['signed_text']);
@ -3267,13 +3462,13 @@ class Diaspora {
$conv = array(
"guid" => $cnv["guid"],
"subject" => $cnv["subject"],
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d H:i:s \U\T\C'),
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d\TH:i:s\Z'),
"diaspora_handle" => $cnv["creator"],
"participant_handles" => $cnv["recips"]
);
$body = bb2diaspora($item["body"]);
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d H:i:s \U\T\C');
$created = datetime_convert("UTC", "UTC", $item["created"], 'Y-m-d\TH:i:s\Z');
$signed_text = $item["guid"].";".$cnv["guid"].";".$body.";".$created.";".$myaddr.";".$cnv['guid'];
$sig = base64_encode(rsa_sign($signed_text, $owner["uprvkey"], "sha256"));
@ -3295,7 +3490,7 @@ class Diaspora {
} else {
$message = array("guid" => $cnv["guid"],
"subject" => $cnv["subject"],
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d H:i:s \U\T\C'),
"created_at" => datetime_convert("UTC", "UTC", $cnv['created'], 'Y-m-d\TH:i:s\Z'),
"message" => $msg,
"diaspora_handle" => $cnv["creator"],
"participant_handles" => $cnv["recips"]);
@ -3424,26 +3619,13 @@ class Diaspora {
$message = self::construct_like($r[0], $contact);
$message["author_signature"] = self::signature($contact, $message);
// In the future we will store the signature more flexible to support new fields.
// Right now we cannot change this since old Friendica versions (prior to 3.5) can only handle this format.
// (We are transmitting this data here via DFRN)
$signed_text = $message["positive"].";".$message["guid"].";".$message["target_type"].";".
$message["parent_guid"].";".$message["diaspora_handle"];
q("INSERT INTO `sign` (`iid`,`signed_text`,`signature`,`signer`) VALUES (%d,'%s','%s','%s')",
intval($post_id),
dbesc($signed_text),
dbesc($message["author_signature"]),
dbesc($message["diaspora_handle"])
// We now store the signature more flexible to dynamically support new fields.
// This will break Diaspora compatibility with Friendica versions prior to 3.5.
q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
intval($message_id),
dbesc(json_encode($message))
);
// This here will replace the lines above, once Diaspora changed its protocol
//q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
// intval($message_id),
// dbesc(json_encode($message))
//);
logger('Stored diaspora like signature');
return true;
}
@ -3470,25 +3652,13 @@ class Diaspora {
$message = self::construct_comment($item, $contact);
$message["author_signature"] = self::signature($contact, $message);
// In the future we will store the signature more flexible to support new fields.
// Right now we cannot change this since old Friendica versions (prior to 3.5) can only handle this format.
// (We are transmitting this data here via DFRN)
$signed_text = $message["guid"].";".$message["parent_guid"].";".
$message["text"].";".$message["diaspora_handle"];
q("INSERT INTO `sign` (`iid`,`signed_text`,`signature`,`signer`) VALUES (%d,'%s','%s','%s')",
// We now store the signature more flexible to dynamically support new fields.
// This will break Diaspora compatibility with Friendica versions prior to 3.5.
q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
intval($message_id),
dbesc($signed_text),
dbesc($message["author_signature"]),
dbesc($message["diaspora_handle"])
dbesc(json_encode($message))
);
// This here will replace the lines above, once Diaspora changed its protocol
//q("INSERT INTO `sign` (`iid`,`signed_text`) VALUES (%d,'%s')",
// intval($message_id),
// dbesc(json_encode($message))
//);
logger('Stored diaspora comment signature');
return true;
}

View file

@ -246,6 +246,7 @@ function event_store($arr) {
$arr['cid'] = ((intval($arr['cid'])) ? intval($arr['cid']) : 0);
$arr['uri'] = (x($arr,'uri') ? $arr['uri'] : item_new_uri($a->get_hostname(),$arr['uid']));
$arr['private'] = ((x($arr,'private')) ? intval($arr['private']) : 0);
$arr['guid'] = get_guid(32);
if($arr['cid'])
$c = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
@ -333,16 +334,16 @@ function event_store($arr) {
call_hooks("event_updated", $arr['id']);
return $item_id;
}
else {
} else {
// New event. Store it.
$r = q("INSERT INTO `event` ( `uid`,`cid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
$r = q("INSERT INTO `event` (`uid`,`cid`,`guid`,`uri`,`created`,`edited`,`start`,`finish`,`summary`, `desc`,`location`,`type`,
`adjust`,`nofinish`,`allow_cid`,`allow_gid`,`deny_cid`,`deny_gid`)
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
VALUES ( %d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, '%s', '%s', '%s', '%s' ) ",
intval($arr['uid']),
intval($arr['cid']),
dbesc($arr['guid']),
dbesc($arr['uri']),
dbesc($arr['created']),
dbesc($arr['edited']),

View file

@ -596,21 +596,25 @@ class ostatus {
$last = get_config('system','ostatus_last_poll');
$poll_interval = intval(get_config('system','ostatus_poll_interval'));
if(! $poll_interval)
$poll_interval = OSTATUS_DEFAULT_POLL_INTERVAL;
if (!$poll_interval) {
$poll_interval = self::OSTATUS_DEFAULT_POLL_INTERVAL;
}
// Don't poll if the interval is set negative
if (($poll_interval < 0) AND !$override)
if (($poll_interval < 0) AND !$override) {
return;
}
if (!$mentions) {
$poll_timeframe = intval(get_config('system','ostatus_poll_timeframe'));
if (!$poll_timeframe)
$poll_timeframe = OSTATUS_DEFAULT_POLL_TIMEFRAME;
if (!$poll_timeframe) {
$poll_timeframe = self::OSTATUS_DEFAULT_POLL_TIMEFRAME;
}
} else {
$poll_timeframe = intval(get_config('system','ostatus_poll_timeframe'));
if (!$poll_timeframe)
$poll_timeframe = OSTATUS_DEFAULT_POLL_TIMEFRAME_MENTIONS;
if (!$poll_timeframe) {
$poll_timeframe = self::OSTATUS_DEFAULT_POLL_TIMEFRAME_MENTIONS;
}
}
@ -626,15 +630,16 @@ class ostatus {
$start = date("Y-m-d H:i:s", time() - ($poll_timeframe * 60));
if ($mentions)
if ($mentions) {
$conversations = q("SELECT `term`.`oid`, `term`.`url`, `term`.`uid` FROM `term`
STRAIGHT_JOIN `thread` ON `thread`.`iid` = `term`.`oid` AND `thread`.`uid` = `term`.`uid`
WHERE `term`.`type` = 7 AND `term`.`term` > '%s' AND `thread`.`mention`
GROUP BY `term`.`url`, `term`.`uid` ORDER BY `term`.`term` DESC", dbesc($start));
else
} else {
$conversations = q("SELECT `oid`, `url`, `uid` FROM `term`
WHERE `type` = 7 AND `term` > '%s'
GROUP BY `url`, `uid` ORDER BY `term` DESC", dbesc($start));
}
foreach ($conversations AS $conversation) {
self::completion($conversation['url'], $conversation['uid']);

View file

@ -285,14 +285,14 @@ function admin_page_federation(&$a) {
// get a total count for the platform, the name and version of the
// highest version and the protocol tpe
$c = qu('SELECT COUNT(*) AS `total`, `platform`, `network`, `version` FROM `gserver`
WHERE `platform` LIKE "%s" AND `last_contact` > `last_failure`
WHERE `platform` LIKE "%s" AND `last_contact` >= `last_failure`
ORDER BY `version` ASC;', $p);
$total = $total + $c[0]['total'];
// what versions for that platform do we know at all?
// again only the active nodes
$v = qu('SELECT COUNT(*) AS `total`, `version` FROM `gserver`
WHERE `last_contact` > `last_failure` AND `platform` LIKE "%s"
WHERE `last_contact` >= `last_failure` AND `platform` LIKE "%s"
GROUP BY `version`
ORDER BY `version`;', $p);

View file

@ -95,8 +95,7 @@ function item_post(&$a) {
$r = q("SELECT * FROM `item` WHERE `id` = %d LIMIT 1",
intval($parent)
);
}
elseif ($parent_uri && local_user()) {
} elseif ($parent_uri && local_user()) {
// This is coming from an API source, and we are logged in
$r = q("SELECT * FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($parent_uri),
@ -141,16 +140,7 @@ function item_post(&$a) {
$thrparent = q("SELECT `author-link`, `network` FROM `item` WHERE `uri` = '%s' LIMIT 1", dbesc($thr_parent));
if (count($thrparent) AND ($thrparent[0]["network"] === NETWORK_OSTATUS)
AND (normalise_link($parent_contact["url"]) != normalise_link($thrparent[0]["author-link"]))) {
$parent_contact = null;
$r = q("SELECT * FROM `gcontact` WHERE `nurl` = '%s' LIMIT 1",
dbesc(normalise_link($thrparent[0]["author-link"])));
if (dbm::is_result($r)) {
$parent_contact = $r[0];
$parent_contact["thumb"] = $parent_contact["photo"];
$parent_contact["micro"] = $parent_contact["photo"];
unset($parent_contact["id"]);
}
$parent_contact = get_contact_details_by_url($thrparent[0]["author-link"]);
if (!isset($parent_contact["nick"])) {
require_once("include/Scrape.php");
@ -568,12 +558,8 @@ function item_post(&$a) {
* add a statusnet style reply tag if the original post was from there
* and we are replying, and there isn't one already
*/
if($parent AND ($parent_contact['network'] === NETWORK_OSTATUS)) {
if ($parent_contact['id'] != "")
$contact = '@'.$parent_contact['nick'].'+'.$parent_contact['id'];
else
$contact = '@[url='.$parent_contact['url'].']'.$parent_contact['nick'].'[/url]';
if ($parent AND ($parent_contact['network'] == NETWORK_OSTATUS)) {
$contact = '@[url='.$parent_contact['url'].']'.$parent_contact['nick'].'[/url]';
if (!in_array($contact,$tags)) {
$body = $contact.' '.$body;

View file

@ -208,6 +208,9 @@ function photos_post(&$a) {
dbesc($album),
intval($page_owner_uid)
);
// Update the photo albums cache
photo_albums($page_owner_uid, true);
$newurl = str_replace(bin2hex($album),bin2hex($newalbum),$_SESSION['photo_return']);
goaway($newurl);
return; // NOTREACHED
@ -294,7 +297,11 @@ function photos_post(&$a) {
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
}
}
// Update the photo albums cache
photo_albums($page_owner_uid, true);
}
goaway('photos/' . $a->data['user']['nickname']);
return; // NOTREACHED
}
@ -359,6 +366,9 @@ function photos_post(&$a) {
$url = App::get_baseurl();
$drop_id = intval($i[0]['id']);
// Update the photo albums cache
photo_albums($page_owner_uid, true);
if ($i[0]['visible'])
proc_run(PRIORITY_HIGH, "include/notifier.php", "drop", $drop_id);
}
@ -370,10 +380,11 @@ function photos_post(&$a) {
if (($a->argc > 2) && ((x($_POST,'desc') !== false) || (x($_POST,'newtag') !== false)) || (x($_POST,'albname') !== false)) {
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
$desc = ((x($_POST,'desc')) ? notags(trim($_POST['desc'])) : '');
$rawtags = ((x($_POST,'newtag')) ? notags(trim($_POST['newtag'])) : '');
$item_id = ((x($_POST,'item_id')) ? intval($_POST['item_id']) : 0);
$albname = ((x($_POST,'albname')) ? notags(trim($_POST['albname'])) : '');
$origaname = ((x($_POST,'origaname')) ? notags(trim($_POST['origaname'])) : '');
$str_group_allow = perms2str($_POST['group_allow']);
$str_contact_allow = perms2str($_POST['contact_allow']);
$str_group_deny = perms2str($_POST['group_deny']);
@ -457,6 +468,10 @@ function photos_post(&$a) {
dbesc($resource_id),
intval($page_owner_uid)
);
// Update the photo albums cache if album name was changed
if ($albname !== $origaname) {
photo_albums($page_owner_uid, true);
}
}
/* Don't make the item visible if the only change was the album name */
@ -913,6 +928,8 @@ function photos_post(&$a) {
. '[/url]';
$item_id = item_store($arr);
// Update the photo albums cache
photo_albums($page_owner_uid, true);
if ($visible)
proc_run(PRIORITY_HIGH, "include/notifier.php", 'wall-new', $item_id);

View file

@ -334,7 +334,9 @@ class Item extends BaseObject {
}
// Disable features that aren't available in several networks
if (($item["item_network"] != NETWORK_DFRN) AND isset($buttons["dislike"])) {
/// @todo Add NETWORK_DIASPORA when it will pass this information
if (!in_array($item["item_network"], array(NETWORK_DFRN)) AND isset($buttons["dislike"])) {
unset($buttons["dislike"],$isevent);
$tagger = '';
}
@ -347,17 +349,13 @@ class Item extends BaseObject {
unset($buttons["like"]);
}
// Diaspora isn't able to do likes on comments - but red does
// Diaspora isn't able to do likes on comments - but Hubzilla does
/// @todo When Diaspora will pass this information we will remove these lines
if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment') AND
!Diaspora::is_redmatrix($item["owner-link"]) AND isset($buttons["like"])) {
unset($buttons["like"]);
}
// Diaspora doesn't has multithreaded comments
if (($item["item_network"] == NETWORK_DIASPORA) AND ($indent == 'comment')) {
unset($comment);
}
// Facebook can like comments - but it isn't programmed in the connector yet.
if (($item["item_network"] == NETWORK_FACEBOOK) AND ($indent == 'comment') AND isset($buttons["like"])) {
unset($buttons["like"]);

View file

@ -1,6 +1,6 @@
<?php
define('UPDATE_VERSION' , 1209);
define('UPDATE_VERSION' , 1211);
/**
*

View file

@ -22,7 +22,7 @@
# Matthias Moritz <matthias@matthiasmoritz.de>, 2012
# Oliver <post@toktan.org>, 2015
# Oliver <post@toktan.org>, 2012
# rabuzarus <rabuzarus@t-online.de>, 2016
# rabuzarus <rabuzarus@t-online.de>, 2016-2017
# Sennewood <sebastian@sebsen.net>, 2013
# Sennewood <sebastian@sebsen.net>, 2012-2013
# silke m <silke@silkemeyer.net>, 2015
@ -36,8 +36,8 @@ msgstr ""
"Project-Id-Version: friendica\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-12-19 07:46+0100\n"
"PO-Revision-Date: 2016-12-19 11:19+0000\n"
"Last-Translator: Tobias Diekershoff <tobias.diekershoff@gmx.net>\n"
"PO-Revision-Date: 2017-01-01 21:19+0000\n"
"Last-Translator: rabuzarus <rabuzarus@t-online.de>\n"
"Language-Team: German (http://www.transifex.com/Friendica/friendica/language/de/)\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
@ -5796,7 +5796,7 @@ msgstr "Browser alle xx Sekunden aktualisieren"
#: mod/settings.php:1003
msgid "Minimum of 10 seconds. Enter -1 to disable it."
msgstr "Minimum sind 10 Sekeunden. Gib -1 ein um abzuschalten."
msgstr "Minimum sind 10 Sekunden. Gib -1 ein um abzuschalten."
#: mod/settings.php:1004
msgid "Number of items to display per page:"

View file

@ -1337,7 +1337,7 @@ $a->strings["Mobile Theme:"] = "Mobiles Theme";
$a->strings["Suppress warning of insecure networks"] = "Warnung wegen unsicheren Netzwerken unterdrücken";
$a->strings["Should the system suppress the warning that the current group contains members of networks that can't receive non public postings."] = "Soll das System Warnungen unterdrücken, die angezeigt werden weil von dir eingerichtete Kontakt-Gruppen Accounts aus Netzwerken beinhalten, die keine nicht öffentlichen Beiträge empfangen können.";
$a->strings["Update browser every xx seconds"] = "Browser alle xx Sekunden aktualisieren";
$a->strings["Minimum of 10 seconds. Enter -1 to disable it."] = "Minimum sind 10 Sekeunden. Gib -1 ein um abzuschalten.";
$a->strings["Minimum of 10 seconds. Enter -1 to disable it."] = "Minimum sind 10 Sekunden. Gib -1 ein um abzuschalten.";
$a->strings["Number of items to display per page:"] = "Zahl der Beiträge, die pro Netzwerkseite angezeigt werden sollen: ";
$a->strings["Maximum of 100 items"] = "Maximal 100 Beiträge";
$a->strings["Number of items to display per page when viewed from mobile device:"] = "Zahl der Beiträge, die pro Netzwerkseite auf mobilen Geräten angezeigt werden sollen:";

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@
<form action="photos/{{$nickname}}/{{$resource_id}}" method="post" id="photo_edit_form" >
<input type="hidden" name="item_id" value="{{$item_id}}" />
<input type="hidden" name="origaname" value="{{$album.2}}" />
{{include file="field_input.tpl" field=$album}}
{{include file="field_input.tpl" field=$caption}}

View file

@ -270,6 +270,7 @@ a#item-delete-selected {
vertical-align: baseline;
background-color: $link_color;
border-radius: 4px;
z-index: 1;
}
aside .badge {
opacity: 0.7;

View file

@ -6,10 +6,9 @@
<form id="poke-form" action="poke" method="get">
<div poke-content-wrapper
<div id="poke-content-wrapper">
{{* The input field with the recipient name*}}
<div id="poke-recip-wrapper" class="form-group">
<label for="poke-recip">{{$clabel}}</label>
<input id="poke-recip" class="form-control" type="text" size="64" maxlength="255" value="{{$name|escape:'html'}}" name="pokename" autocomplete="off" />
@ -17,6 +16,7 @@
<input id="poke-parent" type="hidden" value="{{$parent}}" name="parent" />
</div>
{{* The drop-down list with different actions *}}
<div id="poke-action-wrapper" class="form-group">
<label for="poke-verb-select">{{$choice}}</label>
<select name="verb" id="poke-verb-select" class="form-control">
@ -26,6 +26,7 @@
</select>
</div>
{{* The checkbox to select if the "poke message" should be private *}}
<div id="poke-private-desc" class="checkbox">
<input type="checkbox" id=poke-private-desc-checkbox" name="private" {{if $parent}}disabled="disabled"{{/if}} value="1" />
<label for="poke-private-desc-checkbox">{{$prv_desc}}</label>
@ -41,7 +42,7 @@
<div id="poke-submit-wrapper-end"></div>
</form>
<div id="poke-wrapper-end"></div>
</div>