Merge remote-tracking branch 'upstream/develop' into 1702-null-date
Conflicts: include/onepoll.php
This commit is contained in:
commit
1624150db4
|
@ -1,4 +1,4 @@
|
||||||
Version 3.5.1
|
Version 3.5.1 (2017-03-12)
|
||||||
Friendica Core:
|
Friendica Core:
|
||||||
Updates to the translations (BG, CA, CS, DE, EO, ES, FR, IS, IT, NL, PL, PT-BR, RU, SV) [translation teams]
|
Updates to the translations (BG, CA, CS, DE, EO, ES, FR, IS, IT, NL, PL, PT-BR, RU, SV) [translation teams]
|
||||||
Fix for a potential XSS vector [heluecht, thanks to Vít Šesták 'v6ak' for reporting the problem]
|
Fix for a potential XSS vector [heluecht, thanks to Vít Šesták 'v6ak' for reporting the problem]
|
||||||
|
@ -33,7 +33,6 @@ Version 3.5.1
|
||||||
ping now works with JSON as well [Hypolite]
|
ping now works with JSON as well [Hypolite]
|
||||||
On pending registrations, an email is now send to inform the user about it [tobiasd]
|
On pending registrations, an email is now send to inform the user about it [tobiasd]
|
||||||
On systems where the registration needs approval, a note for the admin can now be written [tobiasd]
|
On systems where the registration needs approval, a note for the admin can now be written [tobiasd]
|
||||||
Theme developers can now announce if their theme does support the RichText editor or not [heluecht, rabuzarus]
|
|
||||||
Meta Information for HTML descriptions is now limited to 160 character [rabuzarus]
|
Meta Information for HTML descriptions is now limited to 160 character [rabuzarus]
|
||||||
Removed very old deprecated themes from the repository [silke]
|
Removed very old deprecated themes from the repository [silke]
|
||||||
Marked frost and frost mobile as deprecated [silke]
|
Marked frost and frost mobile as deprecated [silke]
|
||||||
|
@ -64,7 +63,7 @@ Version 3.5.1
|
||||||
2850, 2858, 2865, 2892, 2894, 2895, 2907, 2908, 2914, 2015, 2926,
|
2850, 2858, 2865, 2892, 2894, 2895, 2907, 2908, 2914, 2015, 2926,
|
||||||
2948, 2955, 2958, 2963, 2964, 2968, 2987, 2993, 3020, 3052, 3062,
|
2948, 2955, 2958, 2963, 2964, 2968, 2987, 2993, 3020, 3052, 3062,
|
||||||
3066, 3091, 3108, 3113, 3116, 3117, 3118, 3126, 3130, 3135, 3155,
|
3066, 3091, 3108, 3113, 3116, 3117, 3118, 3126, 3130, 3135, 3155,
|
||||||
3163
|
3160, 3163, 3187, 3196
|
||||||
|
|
||||||
Version 3.5 (2016-09-13)
|
Version 3.5 (2016-09-13)
|
||||||
Friendica Core:
|
Friendica Core:
|
||||||
|
|
4
boot.php
4
boot.php
|
@ -38,9 +38,9 @@ require_once('include/dbstructure.php');
|
||||||
|
|
||||||
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
define ( 'FRIENDICA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
define ( 'FRIENDICA_CODENAME', 'Asparagus');
|
||||||
define ( 'FRIENDICA_VERSION', '3.5.1-rc' );
|
define ( 'FRIENDICA_VERSION', '3.5.2-dev' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1214 );
|
define ( 'DB_UPDATE_VERSION', 1215 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constant with a HTML line break.
|
* @brief Constant with a HTML line break.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
-- Friendica 3.5.1-dev (Asparagus)
|
-- Friendica 3.5.1-rc (Asparagus)
|
||||||
-- DB_UPDATE_VERSION 1213
|
-- DB_UPDATE_VERSION 1215
|
||||||
-- ------------------------------------------
|
-- ------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -532,6 +532,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
INDEX `parent-uri` (`parent-uri`),
|
INDEX `parent-uri` (`parent-uri`),
|
||||||
INDEX `extid` (`extid`),
|
INDEX `extid` (`extid`),
|
||||||
INDEX `uid_id` (`uid`,`id`),
|
INDEX `uid_id` (`uid`,`id`),
|
||||||
|
INDEX `uid_contactid_id` (`uid`,`contact-id`,`id`),
|
||||||
INDEX `uid_created` (`uid`,`created`),
|
INDEX `uid_created` (`uid`,`created`),
|
||||||
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
|
INDEX `uid_unseen_contactid` (`uid`,`unseen`,`contact-id`),
|
||||||
INDEX `uid_network_received` (`uid`,`network`,`received`),
|
INDEX `uid_network_received` (`uid`,`network`,`received`),
|
||||||
|
@ -1016,7 +1017,8 @@ CREATE TABLE IF NOT EXISTS `thread` (
|
||||||
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
|
INDEX `uid_contactid_commented` (`uid`,`contact-id`,`commented`),
|
||||||
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
INDEX `uid_contactid_created` (`uid`,`contact-id`,`created`),
|
||||||
INDEX `uid_created` (`uid`,`created`),
|
INDEX `uid_created` (`uid`,`created`),
|
||||||
INDEX `uid_commented` (`uid`,`commented`)
|
INDEX `uid_commented` (`uid`,`commented`),
|
||||||
|
INDEX `uid_wall_created` (`uid`,`wall`,`created`)
|
||||||
) DEFAULT CHARSET=utf8mb4;
|
) DEFAULT CHARSET=utf8mb4;
|
||||||
|
|
||||||
--
|
--
|
||||||
|
|
|
@ -1,7 +1,5 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
require_once('include/Probe.php');
|
|
||||||
|
|
||||||
// Included here for completeness, but this is a very dangerous operation.
|
// Included here for completeness, but this is a very dangerous operation.
|
||||||
// It is the caller's responsibility to confirm the requestor's intent and
|
// It is the caller's responsibility to confirm the requestor's intent and
|
||||||
// authorisation to do this.
|
// authorisation to do this.
|
||||||
|
@ -355,6 +353,7 @@ function get_contact_details_by_addr($addr, $uid = -1) {
|
||||||
dbesc($addr));
|
dbesc($addr));
|
||||||
|
|
||||||
if (!dbm::is_result($r)) {
|
if (!dbm::is_result($r)) {
|
||||||
|
require_once('include/Probe.php');
|
||||||
$data = Probe::uri($addr);
|
$data = Probe::uri($addr);
|
||||||
|
|
||||||
$profile = get_contact_details_by_url($data['url'], $uid);
|
$profile = get_contact_details_by_url($data['url'], $uid);
|
||||||
|
@ -508,72 +507,96 @@ function contacts_not_grouped($uid,$start = 0,$count = 0) {
|
||||||
/**
|
/**
|
||||||
* @brief Fetch the contact id for a given url and user
|
* @brief Fetch the contact id for a given url and user
|
||||||
*
|
*
|
||||||
|
* First lookup in the contact table to find a record matching either `url`, `nurl`,
|
||||||
|
* `addr` or `alias`.
|
||||||
|
*
|
||||||
|
* If there's no record and we aren't looking for a public contact, we quit.
|
||||||
|
* If there's one, we check that it isn't time to update the picture else we
|
||||||
|
* directly return the found contact id.
|
||||||
|
*
|
||||||
|
* Second, we probe the provided $url wether it's http://server.tld/profile or
|
||||||
|
* nick@server.tld. We quit if we can't get any info back.
|
||||||
|
*
|
||||||
|
* Third, we create the contact record if it doesn't exist
|
||||||
|
*
|
||||||
|
* Fourth, we update the existing record with the new data (avatar, alias, nick)
|
||||||
|
* if there's any updates
|
||||||
|
*
|
||||||
* @param string $url Contact URL
|
* @param string $url Contact URL
|
||||||
* @param integer $uid The user id for the contact
|
* @param integer $uid The user id for the contact (0 = public contact)
|
||||||
* @param boolean $no_update Don't update the contact
|
* @param boolean $no_update Don't update the contact
|
||||||
*
|
*
|
||||||
* @return integer Contact ID
|
* @return integer Contact ID
|
||||||
*/
|
*/
|
||||||
function get_contact($url, $uid = 0, $no_update = false) {
|
function get_contact($url, $uid = 0, $no_update = false) {
|
||||||
require_once("include/Scrape.php");
|
|
||||||
|
|
||||||
logger("Get contact data for url ".$url." and user ".$uid." - ".App::callstack(), LOGGER_DEBUG);;
|
logger("Get contact data for url ".$url." and user ".$uid." - ".App::callstack(), LOGGER_DEBUG);;
|
||||||
|
|
||||||
$data = array();
|
$data = array();
|
||||||
$contactid = 0;
|
$contact_id = 0;
|
||||||
|
|
||||||
// is it an address in the format user@server.tld?
|
// We first try the nurl (http://server.tld/nick), most common case
|
||||||
/// @todo use gcontact and/or the addr field for a lookup
|
$contacts = q("SELECT `id`, `avatar-date` FROM `contact`
|
||||||
if (!strstr($url, "http") OR strstr($url, "@")) {
|
WHERE `nurl` = '%s'
|
||||||
$data = probe_url($url);
|
AND `uid` = %d",
|
||||||
$url = $data["url"];
|
|
||||||
if ($url == "")
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact = q("SELECT `id`, `avatar-date` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d ORDER BY `id` LIMIT 2",
|
|
||||||
dbesc(normalise_link($url)),
|
dbesc(normalise_link($url)),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
|
||||||
if (!$contact)
|
|
||||||
$contact = q("SELECT `id`, `avatar-date` FROM `contact` WHERE `alias` IN ('%s', '%s') AND `uid` = %d ORDER BY `id` LIMIT 1",
|
// Then the addr (nick@server.tld)
|
||||||
|
if (! dbm::is_result($contacts)) {
|
||||||
|
$contacts = q("SELECT `id`, `avatar-date` FROM `contact`
|
||||||
|
WHERE `addr` = '%s'
|
||||||
|
AND `uid` = %d",
|
||||||
|
dbesc($url),
|
||||||
|
intval($uid));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Then the alias (which could be anything)
|
||||||
|
if (! dbm::is_result($contacts)) {
|
||||||
|
$contacts = q("SELECT `id`, `avatar-date` FROM `contact`
|
||||||
|
WHERE `alias` IN ('%s', '%s')
|
||||||
|
AND `uid` = %d",
|
||||||
dbesc($url),
|
dbesc($url),
|
||||||
dbesc(normalise_link($url)),
|
dbesc(normalise_link($url)),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
|
}
|
||||||
|
|
||||||
if ($contact) {
|
if (dbm::is_result($contacts)) {
|
||||||
$contactid = $contact[0]["id"];
|
$contact_id = $contacts[0]["id"];
|
||||||
|
|
||||||
// Update the contact every 7 days
|
// Update the contact every 7 days
|
||||||
$update_photo = ($contact[0]['avatar-date'] < datetime_convert('','','now -7 days'));
|
$update_photo = ($contacts[0]['avatar-date'] < datetime_convert('','','now -7 days'));
|
||||||
//$update_photo = ($contact[0]['avatar-date'] < datetime_convert('','','now -12 hours'));
|
|
||||||
|
|
||||||
if (!$update_photo OR $no_update) {
|
if (!$update_photo OR $no_update) {
|
||||||
return($contactid);
|
return $contact_id;
|
||||||
}
|
}
|
||||||
} elseif ($uid != 0)
|
} elseif ($uid != 0) {
|
||||||
|
// Non-existing user-specific contact, exiting
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (!count($data))
|
require_once('include/Probe.php');
|
||||||
$data = probe_url($url);
|
$data = Probe::uri($url);
|
||||||
|
|
||||||
// Does this address belongs to a valid network?
|
// Last try in gcontact for unsupported networks
|
||||||
if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
|
if (!in_array($data["network"], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA, NETWORK_PUMPIO))) {
|
||||||
if ($uid != 0)
|
if ($uid != 0) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
// Get data from the gcontact table
|
// Get data from the gcontact table
|
||||||
$r = q("SELECT `name`, `nick`, `url`, `photo`, `addr`, `alias`, `network` FROM `gcontact` WHERE `nurl` = '%s'",
|
$gcontacts = q("SELECT `name`, `nick`, `url`, `photo`, `addr`, `alias`, `network` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||||
dbesc(normalise_link($url)));
|
dbesc(normalise_link($url)));
|
||||||
if (!$r)
|
if (!$gcontacts) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$data = $r[0];
|
$data = $gcontacts[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
$url = $data["url"];
|
$url = $data["url"];
|
||||||
|
|
||||||
if ($contactid == 0) {
|
if (!$contact_id) {
|
||||||
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
q("INSERT INTO `contact` (`uid`, `created`, `url`, `nurl`, `addr`, `alias`, `notify`, `poll`,
|
||||||
`name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
|
`name`, `nick`, `photo`, `network`, `pubkey`, `rel`, `priority`,
|
||||||
`batch`, `request`, `confirm`, `poco`, `name-date`, `uri-date`,
|
`batch`, `request`, `confirm`, `poco`, `name-date`, `uri-date`,
|
||||||
|
@ -602,45 +625,48 @@ function get_contact($url, $uid = 0, $no_update = false) {
|
||||||
dbesc(datetime_convert())
|
dbesc(datetime_convert())
|
||||||
);
|
);
|
||||||
|
|
||||||
$contact = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d ORDER BY `id` LIMIT 2",
|
$contacts = q("SELECT `id` FROM `contact` WHERE `nurl` = '%s' AND `uid` = %d ORDER BY `id` LIMIT 2",
|
||||||
dbesc(normalise_link($data["url"])),
|
dbesc(normalise_link($data["url"])),
|
||||||
intval($uid));
|
intval($uid));
|
||||||
if (!$contact)
|
if (!dbm::is_result($contacts)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
$contactid = $contact[0]["id"];
|
$contact_id = $contacts[0]["id"];
|
||||||
|
|
||||||
// Update the newly created contact from data in the gcontact table
|
// Update the newly created contact from data in the gcontact table
|
||||||
$r = q("SELECT `location`, `about`, `keywords`, `gender` FROM `gcontact` WHERE `nurl` = '%s'",
|
$gcontacts = q("SELECT `location`, `about`, `keywords`, `gender` FROM `gcontact` WHERE `nurl` = '%s'",
|
||||||
dbesc(normalise_link($data["url"])));
|
dbesc(normalise_link($data["url"])));
|
||||||
if ($r) {
|
if (dbm::is_result($gcontacts)) {
|
||||||
logger("Update contact ".$data["url"]);
|
logger("Update contact " . $data["url"] . ' from gcontact');
|
||||||
q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d",
|
q("UPDATE `contact` SET `location` = '%s', `about` = '%s', `keywords` = '%s', `gender` = '%s' WHERE `id` = %d",
|
||||||
dbesc($r["location"]), dbesc($r["about"]), dbesc($r["keywords"]),
|
dbesc($gcontacts[0]["location"]), dbesc($gcontacts[0]["about"]), dbesc($gcontacts[0]["keywords"]),
|
||||||
dbesc($r["gender"]), intval($contactid));
|
dbesc($gcontacts[0]["gender"]), intval($contact_id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((count($contact) > 1) AND ($uid == 0) AND ($contactid != 0) AND ($url != ""))
|
if (count($contacts) > 1 AND $uid == 0 AND $contact_id != 0 AND $url != "") {
|
||||||
q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `id` != %d AND NOT `self`",
|
q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `id` != %d AND NOT `self`",
|
||||||
dbesc(normalise_link($url)),
|
dbesc(normalise_link($url)),
|
||||||
intval($contactid));
|
intval($contact_id));
|
||||||
|
}
|
||||||
|
|
||||||
require_once("Photo.php");
|
require_once "Photo.php";
|
||||||
|
|
||||||
update_contact_avatar($data["photo"],$uid,$contactid);
|
update_contact_avatar($data["photo"], $uid, $contact_id);
|
||||||
|
|
||||||
$r = q("SELECT `addr`, `alias`, `name`, `nick` FROM `contact` WHERE `id` = %d", intval($contactid));
|
$contacts = q("SELECT `addr`, `alias`, `name`, `nick` FROM `contact` WHERE `id` = %d", intval($contact_id));
|
||||||
|
|
||||||
// This condition should always be true
|
// This condition should always be true
|
||||||
if (!dbm::is_result($r))
|
if (!dbm::is_result($contacts)) {
|
||||||
return $contactid;
|
return $contact_id;
|
||||||
|
}
|
||||||
|
|
||||||
// Only update if there had something been changed
|
// Only update if there had something been changed
|
||||||
if (($data["addr"] != $r[0]["addr"]) OR
|
if ($data["addr"] != $contacts[0]["addr"] OR
|
||||||
($data["alias"] != $r[0]["alias"]) OR
|
$data["alias"] != $contacts[0]["alias"] OR
|
||||||
($data["name"] != $r[0]["name"]) OR
|
$data["name"] != $contacts[0]["name"] OR
|
||||||
($data["nick"] != $r[0]["nick"]))
|
$data["nick"] != $contacts[0]["nick"]) {
|
||||||
q("UPDATE `contact` SET `addr` = '%s', `alias` = '%s', `name` = '%s', `nick` = '%s',
|
q("UPDATE `contact` SET `addr` = '%s', `alias` = '%s', `name` = '%s', `nick` = '%s',
|
||||||
`name-date` = '%s', `uri-date` = '%s' WHERE `id` = %d",
|
`name-date` = '%s', `uri-date` = '%s' WHERE `id` = %d",
|
||||||
dbesc($data["addr"]),
|
dbesc($data["addr"]),
|
||||||
|
@ -649,10 +675,11 @@ function get_contact($url, $uid = 0, $no_update = false) {
|
||||||
dbesc($data["nick"]),
|
dbesc($data["nick"]),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
dbesc(datetime_convert()),
|
dbesc(datetime_convert()),
|
||||||
intval($contactid)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
return $contactid;
|
return $contact_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -60,11 +60,20 @@ class Probe {
|
||||||
$xrd_timeout = Config::get('system','xrd_timeout', 20);
|
$xrd_timeout = Config::get('system','xrd_timeout', 20);
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
|
|
||||||
$xml = fetch_url($ssl_url, false, $redirects, $xrd_timeout, "application/xrd+xml");
|
$ret = z_fetch_url($ssl_url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$xml = $ret['body'];
|
||||||
|
|
||||||
$xrd = parse_xml_string($xml, false);
|
$xrd = parse_xml_string($xml, false);
|
||||||
|
|
||||||
if (!is_object($xrd)) {
|
if (!is_object($xrd)) {
|
||||||
$xml = fetch_url($url, false, $redirects, $xrd_timeout, "application/xrd+xml");
|
$ret = z_fetch_url($url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$xml = $ret['body'];
|
||||||
$xrd = parse_xml_string($xml, false);
|
$xrd = parse_xml_string($xml, false);
|
||||||
}
|
}
|
||||||
if (!is_object($xrd))
|
if (!is_object($xrd))
|
||||||
|
@ -430,7 +439,12 @@ class Probe {
|
||||||
$xrd_timeout = Config::get('system','xrd_timeout', 20);
|
$xrd_timeout = Config::get('system','xrd_timeout', 20);
|
||||||
$redirects = 0;
|
$redirects = 0;
|
||||||
|
|
||||||
$data = fetch_url($url, false, $redirects, $xrd_timeout, "application/xrd+xml");
|
$ret = z_fetch_url($url, false, $redirects, array('timeout' => $xrd_timeout, 'accept_content' => 'application/xrd+xml'));
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$data = $ret['body'];
|
||||||
|
|
||||||
$xrd = parse_xml_string($data, false);
|
$xrd = parse_xml_string($data, false);
|
||||||
|
|
||||||
if (!is_object($xrd)) {
|
if (!is_object($xrd)) {
|
||||||
|
@ -482,9 +496,14 @@ class Probe {
|
||||||
* @return array noscrape data
|
* @return array noscrape data
|
||||||
*/
|
*/
|
||||||
private function poll_noscrape($noscrape, $data) {
|
private function poll_noscrape($noscrape, $data) {
|
||||||
$content = fetch_url($noscrape);
|
$ret = z_fetch_url($noscrape);
|
||||||
if (!$content)
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
$content = $ret['body'];
|
||||||
|
if (!$content) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$json = json_decode($content, true);
|
$json = json_decode($content, true);
|
||||||
if (!is_array($json))
|
if (!is_array($json))
|
||||||
|
@ -663,10 +682,14 @@ class Probe {
|
||||||
* @return array hcard data
|
* @return array hcard data
|
||||||
*/
|
*/
|
||||||
private function poll_hcard($hcard, $data, $dfrn = false) {
|
private function poll_hcard($hcard, $data, $dfrn = false) {
|
||||||
|
$ret = z_fetch_url($hcard);
|
||||||
$content = fetch_url($hcard);
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
if (!$content)
|
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
$content = $ret['body'];
|
||||||
|
if (!$content) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$doc = new DOMDocument();
|
$doc = new DOMDocument();
|
||||||
if (!@$doc->loadHTML($content))
|
if (!@$doc->loadHTML($content))
|
||||||
|
@ -859,8 +882,13 @@ class Probe {
|
||||||
$pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
|
$pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
|
||||||
else
|
else
|
||||||
$pubkey = substr($pubkey, 5);
|
$pubkey = substr($pubkey, 5);
|
||||||
} elseif (normalise_link($pubkey) == 'http://')
|
} elseif (normalise_link($pubkey) == 'http://') {
|
||||||
$pubkey = fetch_url($pubkey);
|
$ret = z_fetch_url($pubkey);
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$pubkey = $ret['body'];
|
||||||
|
}
|
||||||
|
|
||||||
$key = explode(".", $pubkey);
|
$key = explode(".", $pubkey);
|
||||||
|
|
||||||
|
@ -880,7 +908,11 @@ class Probe {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Fetch all additional data from the feed
|
// Fetch all additional data from the feed
|
||||||
$feed = fetch_url($data["poll"]);
|
$ret = z_fetch_url($data["poll"]);
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$feed = $ret['body'];
|
||||||
$feed_data = feed_import($feed,$dummy1,$dummy2, $dummy3, true);
|
$feed_data = feed_import($feed,$dummy1,$dummy2, $dummy3, true);
|
||||||
if (!$feed_data)
|
if (!$feed_data)
|
||||||
return false;
|
return false;
|
||||||
|
@ -1035,7 +1067,11 @@ class Probe {
|
||||||
* @return array feed data
|
* @return array feed data
|
||||||
*/
|
*/
|
||||||
private function feed($url, $probe = true) {
|
private function feed($url, $probe = true) {
|
||||||
$feed = fetch_url($url);
|
$ret = z_fetch_url($url);
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$feed = $ret['body'];
|
||||||
$feed_data = feed_import($feed, $dummy1, $dummy2, $dummy3, true);
|
$feed_data = feed_import($feed, $dummy1, $dummy2, $dummy3, true);
|
||||||
|
|
||||||
if (!$feed_data) {
|
if (!$feed_data) {
|
||||||
|
|
|
@ -39,9 +39,9 @@ function diaspora2bb($s) {
|
||||||
$s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
|
$s = html_entity_decode($s, ENT_COMPAT, 'UTF-8');
|
||||||
|
|
||||||
// Handles single newlines
|
// Handles single newlines
|
||||||
$s = str_replace("\r", '<br>', $s);
|
$s = str_replace("\r\n", "\n", $s);
|
||||||
|
|
||||||
$s = str_replace("\n", " \n", $s);
|
$s = str_replace("\n", " \n", $s);
|
||||||
|
$s = str_replace("\r", " \n", $s);
|
||||||
|
|
||||||
// Replace lonely stars in lines not starting with it with literal stars
|
// Replace lonely stars in lines not starting with it with literal stars
|
||||||
$s = preg_replace('/^([^\*]+)\*([^\*]*)$/im', '$1\*$2', $s);
|
$s = preg_replace('/^([^\*]+)\*([^\*]*)$/im', '$1\*$2', $s);
|
||||||
|
|
|
@ -1163,8 +1163,10 @@ function bbcode($Text,$preserve_nl = false, $tryoembed = true, $simplehtml = fal
|
||||||
// fix any escaped ampersands that may have been converted into links
|
// fix any escaped ampersands that may have been converted into links
|
||||||
$Text = preg_replace('/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism', '<$1$2=$3&$4>', $Text);
|
$Text = preg_replace('/\<([^>]*?)(src|href)=(.*?)\&\;(.*?)\>/ism', '<$1$2=$3&$4>', $Text);
|
||||||
|
|
||||||
// sanitizes src attributes (only relative redir URIs or http URLs)
|
// sanitizes src attributes (http and redir URLs for displaying in a web page, cid used for inline images in emails)
|
||||||
$Text = preg_replace('#<([^>]*?)(src)="(?!http|redir)(.*?)"(.*?)>#ism', '<$1$2=""$4 class="invalid-src" title="' . t('Invalid source protocol') . '">', $Text);
|
static $allowed_src_protocols = array('http', 'redir', 'cid');
|
||||||
|
$Text = preg_replace('#<([^>]*?)(src)="(?!' . implode('|', $allowed_src_protocols) . ')(.*?)"(.*?)>#ism',
|
||||||
|
'<$1$2=""$4 class="invalid-src" title="' . t('Invalid source protocol') . '">', $Text);
|
||||||
|
|
||||||
// sanitize href attributes (only whitelisted protocols URLs)
|
// sanitize href attributes (only whitelisted protocols URLs)
|
||||||
// default value for backward compatibility
|
// default value for backward compatibility
|
||||||
|
|
|
@ -1526,6 +1526,7 @@ function db_definition($charset) {
|
||||||
"uid_contactid_created" => array("uid","contact-id","created"),
|
"uid_contactid_created" => array("uid","contact-id","created"),
|
||||||
"uid_created" => array("uid","created"),
|
"uid_created" => array("uid","created"),
|
||||||
"uid_commented" => array("uid","commented"),
|
"uid_commented" => array("uid","commented"),
|
||||||
|
"uid_wall_created" => array("uid","wall","created"),
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
$database["tokens"] = array(
|
$database["tokens"] = array(
|
||||||
|
|
|
@ -398,7 +398,7 @@ function delivery_run(&$argv, &$argc){
|
||||||
|
|
||||||
logger('notifier: dfrn_delivery to '.$contact["url"].' with guid '.$target_item["guid"].' returns '.$deliver_status);
|
logger('notifier: dfrn_delivery to '.$contact["url"].' with guid '.$target_item["guid"].' returns '.$deliver_status);
|
||||||
|
|
||||||
if ($deliver_status == (-1)) {
|
if ($deliver_status < 0) {
|
||||||
logger('notifier: delivery failed: queuing message');
|
logger('notifier: delivery failed: queuing message');
|
||||||
add_to_queue($contact['id'],NETWORK_DFRN,$atom);
|
add_to_queue($contact['id'],NETWORK_DFRN,$atom);
|
||||||
|
|
||||||
|
|
|
@ -391,7 +391,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return object XML root object
|
* @return object XML root object
|
||||||
*/
|
*/
|
||||||
private function add_header($doc, $owner, $authorelement, $alternatelink = "", $public = false) {
|
private static function add_header($doc, $owner, $authorelement, $alternatelink = "", $public = false) {
|
||||||
|
|
||||||
if ($alternatelink == "")
|
if ($alternatelink == "")
|
||||||
$alternatelink = $owner['url'];
|
$alternatelink = $owner['url'];
|
||||||
|
@ -462,7 +462,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return object XML author object
|
* @return object XML author object
|
||||||
*/
|
*/
|
||||||
private function add_author($doc, $owner, $authorelement, $public) {
|
private static function add_author($doc, $owner, $authorelement, $public) {
|
||||||
|
|
||||||
// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
|
// Is the profile hidden or shouldn't be published in the net? Then add the "hide" element
|
||||||
$r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
$r = q("SELECT `id` FROM `profile` INNER JOIN `user` ON `user`.`uid` = `profile`.`uid`
|
||||||
|
@ -591,7 +591,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return object XML author object
|
* @return object XML author object
|
||||||
*/
|
*/
|
||||||
private function add_entry_author($doc, $element, $contact_url, $item) {
|
private static function add_entry_author($doc, $element, $contact_url, $item) {
|
||||||
|
|
||||||
$contact = get_contact_details_by_url($contact_url, $item["uid"]);
|
$contact = get_contact_details_by_url($contact_url, $item["uid"]);
|
||||||
|
|
||||||
|
@ -631,7 +631,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return object XML activity object
|
* @return object XML activity object
|
||||||
*/
|
*/
|
||||||
private function create_activity($doc, $element, $activity) {
|
private static function create_activity($doc, $element, $activity) {
|
||||||
|
|
||||||
if($activity) {
|
if($activity) {
|
||||||
$entry = $doc->createElement($element);
|
$entry = $doc->createElement($element);
|
||||||
|
@ -685,7 +685,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return object XML attachment object
|
* @return object XML attachment object
|
||||||
*/
|
*/
|
||||||
private function get_attachment($doc, $root, $item) {
|
private static function get_attachment($doc, $root, $item) {
|
||||||
$arr = explode('[/attach],',$item['attach']);
|
$arr = explode('[/attach],',$item['attach']);
|
||||||
if(count($arr)) {
|
if(count($arr)) {
|
||||||
foreach($arr as $r) {
|
foreach($arr as $r) {
|
||||||
|
@ -720,7 +720,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return object XML entry object
|
* @return object XML entry object
|
||||||
*/
|
*/
|
||||||
private function entry($doc, $type, $item, $owner, $comment = false, $cid = 0) {
|
private static function entry($doc, $type, $item, $owner, $comment = false, $cid = 0) {
|
||||||
|
|
||||||
$mentioned = array();
|
$mentioned = array();
|
||||||
|
|
||||||
|
@ -913,11 +913,18 @@ class dfrn {
|
||||||
|
|
||||||
logger('dfrn_deliver: ' . $url);
|
logger('dfrn_deliver: ' . $url);
|
||||||
|
|
||||||
$xml = fetch_url($url);
|
$ret = z_fetch_url($url);
|
||||||
|
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return -2; // timed out
|
||||||
|
}
|
||||||
|
|
||||||
|
$xml = $ret['body'];
|
||||||
|
|
||||||
$curl_stat = $a->get_curl_code();
|
$curl_stat = $a->get_curl_code();
|
||||||
if(! $curl_stat)
|
if (!$curl_stat) {
|
||||||
return(-1); // timed out
|
return -3; // timed out
|
||||||
|
}
|
||||||
|
|
||||||
logger('dfrn_deliver: ' . $xml, LOGGER_DATA);
|
logger('dfrn_deliver: ' . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
|
@ -1017,24 +1024,24 @@ class dfrn {
|
||||||
$key = Crypto::createNewRandomKey();
|
$key = Crypto::createNewRandomKey();
|
||||||
} catch (CryptoTestFailed $ex) {
|
} catch (CryptoTestFailed $ex) {
|
||||||
logger('Cannot safely create a key');
|
logger('Cannot safely create a key');
|
||||||
return -1;
|
return -4;
|
||||||
} catch (CannotPerformOperation $ex) {
|
} catch (CannotPerformOperation $ex) {
|
||||||
logger('Cannot safely create a key');
|
logger('Cannot safely create a key');
|
||||||
return -1;
|
return -5;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
$data = Crypto::encrypt($postvars['data'], $key);
|
$data = Crypto::encrypt($postvars['data'], $key);
|
||||||
} catch (CryptoTestFailed $ex) {
|
} catch (CryptoTestFailed $ex) {
|
||||||
logger('Cannot safely perform encryption');
|
logger('Cannot safely perform encryption');
|
||||||
return -1;
|
return -6;
|
||||||
} catch (CannotPerformOperation $ex) {
|
} catch (CannotPerformOperation $ex) {
|
||||||
logger('Cannot safely perform encryption');
|
logger('Cannot safely perform encryption');
|
||||||
return -1;
|
return -7;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
logger("rino: invalid requested verision '$rino_remote_version'");
|
logger("rino: invalid requested verision '$rino_remote_version'");
|
||||||
return -1;
|
return -8;
|
||||||
}
|
}
|
||||||
|
|
||||||
$postvars['rino'] = $rino_remote_version;
|
$postvars['rino'] = $rino_remote_version;
|
||||||
|
@ -1073,11 +1080,13 @@ class dfrn {
|
||||||
logger('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
|
logger('dfrn_deliver: ' . "RECEIVED: " . $xml, LOGGER_DATA);
|
||||||
|
|
||||||
$curl_stat = $a->get_curl_code();
|
$curl_stat = $a->get_curl_code();
|
||||||
if((! $curl_stat) || (! strlen($xml)))
|
if ((!$curl_stat) || (!strlen($xml))) {
|
||||||
return(-1); // timed out
|
return -9; // timed out
|
||||||
|
}
|
||||||
|
|
||||||
if(($curl_stat == 503) && (stristr($a->get_curl_headers(),'retry-after')))
|
if (($curl_stat == 503) && (stristr($a->get_curl_headers(),'retry-after'))) {
|
||||||
return(-1);
|
return -10;
|
||||||
|
}
|
||||||
|
|
||||||
if(strpos($xml,'<?xml') === false) {
|
if(strpos($xml,'<?xml') === false) {
|
||||||
logger('dfrn_deliver: phase 2: no valid XML returned');
|
logger('dfrn_deliver: phase 2: no valid XML returned');
|
||||||
|
@ -1103,7 +1112,7 @@ class dfrn {
|
||||||
* @param string $birthday Birthday of the contact
|
* @param string $birthday Birthday of the contact
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private function birthday_event($contact, $birthday) {
|
private static function birthday_event($contact, $birthday) {
|
||||||
|
|
||||||
// Check for duplicates
|
// Check for duplicates
|
||||||
$r = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
|
$r = q("SELECT `id` FROM `event` WHERE `uid` = %d AND `cid` = %d AND `start` = '%s' AND `type` = '%s' LIMIT 1",
|
||||||
|
@ -1146,7 +1155,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return Returns an array with relevant data of the author
|
* @return Returns an array with relevant data of the author
|
||||||
*/
|
*/
|
||||||
private function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "") {
|
private static function fetchauthor($xpath, $context, $importer, $element, $onlyfetch, $xml = "") {
|
||||||
|
|
||||||
$author = array();
|
$author = array();
|
||||||
$author["name"] = $xpath->evaluate($element."/atom:name/text()", $context)->item(0)->nodeValue;
|
$author["name"] = $xpath->evaluate($element."/atom:name/text()", $context)->item(0)->nodeValue;
|
||||||
|
@ -1358,7 +1367,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return string XML string
|
* @return string XML string
|
||||||
*/
|
*/
|
||||||
private function transform_activity($xpath, $activity, $element) {
|
private static function transform_activity($xpath, $activity, $element) {
|
||||||
if (!is_object($activity))
|
if (!is_object($activity))
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
@ -1403,7 +1412,7 @@ class dfrn {
|
||||||
* @param object $mail mail elements
|
* @param object $mail mail elements
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
*/
|
*/
|
||||||
private function process_mail($xpath, $mail, $importer) {
|
private static function process_mail($xpath, $mail, $importer) {
|
||||||
|
|
||||||
logger("Processing mails");
|
logger("Processing mails");
|
||||||
|
|
||||||
|
@ -1454,7 +1463,7 @@ class dfrn {
|
||||||
* @param object $suggestion suggestion elements
|
* @param object $suggestion suggestion elements
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
*/
|
*/
|
||||||
private function process_suggestion($xpath, $suggestion, $importer) {
|
private static function process_suggestion($xpath, $suggestion, $importer) {
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
|
||||||
logger("Processing suggestions");
|
logger("Processing suggestions");
|
||||||
|
@ -1556,7 +1565,7 @@ class dfrn {
|
||||||
* @param object $relocation relocation elements
|
* @param object $relocation relocation elements
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
*/
|
*/
|
||||||
private function process_relocation($xpath, $relocation, $importer) {
|
private static function process_relocation($xpath, $relocation, $importer) {
|
||||||
|
|
||||||
logger("Processing relocations");
|
logger("Processing relocations");
|
||||||
|
|
||||||
|
@ -1685,7 +1694,7 @@ class dfrn {
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
* @param int $entrytype Is it a toplevel entry, a comment or a relayed comment?
|
* @param int $entrytype Is it a toplevel entry, a comment or a relayed comment?
|
||||||
*/
|
*/
|
||||||
private function update_content($current, $item, $importer, $entrytype) {
|
private static function update_content($current, $item, $importer, $entrytype) {
|
||||||
$changed = false;
|
$changed = false;
|
||||||
|
|
||||||
if (edited_timestamp_is_newer($current, $item)) {
|
if (edited_timestamp_is_newer($current, $item)) {
|
||||||
|
@ -1737,7 +1746,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return int Is it a toplevel entry, a comment or a relayed comment?
|
* @return int Is it a toplevel entry, a comment or a relayed comment?
|
||||||
*/
|
*/
|
||||||
private function get_entry_type($importer, $item) {
|
private static function get_entry_type($importer, $item) {
|
||||||
if ($item["parent-uri"] != $item["uri"]) {
|
if ($item["parent-uri"] != $item["uri"]) {
|
||||||
$community = false;
|
$community = false;
|
||||||
|
|
||||||
|
@ -1803,7 +1812,7 @@ class dfrn {
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
* @param int $posted_id The record number of item record that was just posted
|
* @param int $posted_id The record number of item record that was just posted
|
||||||
*/
|
*/
|
||||||
private function do_poke($item, $importer, $posted_id) {
|
private static function do_poke($item, $importer, $posted_id) {
|
||||||
$verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
|
$verb = urldecode(substr($item["verb"],strpos($item["verb"], "#")+1));
|
||||||
if(!$verb)
|
if(!$verb)
|
||||||
return;
|
return;
|
||||||
|
@ -1858,7 +1867,7 @@ class dfrn {
|
||||||
*
|
*
|
||||||
* @return bool Should the processing of the entries be continued?
|
* @return bool Should the processing of the entries be continued?
|
||||||
*/
|
*/
|
||||||
private function process_verbs($entrytype, $importer, &$item, &$is_like) {
|
private static function process_verbs($entrytype, $importer, &$item, &$is_like) {
|
||||||
|
|
||||||
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
|
logger("Process verb ".$item["verb"]." and object-type ".$item["object-type"]." for entrytype ".$entrytype, LOGGER_DEBUG);
|
||||||
|
|
||||||
|
@ -1958,7 +1967,7 @@ class dfrn {
|
||||||
* @param object $links link elements
|
* @param object $links link elements
|
||||||
* @param array $item the item record
|
* @param array $item the item record
|
||||||
*/
|
*/
|
||||||
private function parse_links($links, &$item) {
|
private static function parse_links($links, &$item) {
|
||||||
$rel = "";
|
$rel = "";
|
||||||
$href = "";
|
$href = "";
|
||||||
$type = "";
|
$type = "";
|
||||||
|
@ -2001,7 +2010,7 @@ class dfrn {
|
||||||
* @param object $entry entry elements
|
* @param object $entry entry elements
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
*/
|
*/
|
||||||
private function process_entry($header, $xpath, $entry, $importer) {
|
private static function process_entry($header, $xpath, $entry, $importer) {
|
||||||
|
|
||||||
logger("Processing entries");
|
logger("Processing entries");
|
||||||
|
|
||||||
|
@ -2010,6 +2019,20 @@ class dfrn {
|
||||||
// Get the uri
|
// Get the uri
|
||||||
$item["uri"] = $xpath->query("atom:id/text()", $entry)->item(0)->nodeValue;
|
$item["uri"] = $xpath->query("atom:id/text()", $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
$item["edited"] = $xpath->query("atom:updated/text()", $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
$current = q("SELECT `id`, `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
||||||
|
dbesc($item["uri"]),
|
||||||
|
intval($importer["importer_uid"])
|
||||||
|
);
|
||||||
|
|
||||||
|
// Is there an existing item?
|
||||||
|
if (dbm::is_result($current) AND edited_timestamp_is_newer($current[0], $item) AND
|
||||||
|
(datetime_convert("UTC","UTC",$item["edited"]) < $current[0]["edited"])) {
|
||||||
|
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Fetch the owner
|
// Fetch the owner
|
||||||
$owner = self::fetchauthor($xpath, $entry, $importer, "dfrn:owner", true);
|
$owner = self::fetchauthor($xpath, $entry, $importer, "dfrn:owner", true);
|
||||||
|
|
||||||
|
@ -2027,7 +2050,6 @@ class dfrn {
|
||||||
$item["title"] = $xpath->query("atom:title/text()", $entry)->item(0)->nodeValue;
|
$item["title"] = $xpath->query("atom:title/text()", $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
$item["created"] = $xpath->query("atom:published/text()", $entry)->item(0)->nodeValue;
|
$item["created"] = $xpath->query("atom:published/text()", $entry)->item(0)->nodeValue;
|
||||||
$item["edited"] = $xpath->query("atom:updated/text()", $entry)->item(0)->nodeValue;
|
|
||||||
|
|
||||||
$item["body"] = $xpath->query("dfrn:env/text()", $entry)->item(0)->nodeValue;
|
$item["body"] = $xpath->query("dfrn:env/text()", $entry)->item(0)->nodeValue;
|
||||||
$item["body"] = str_replace(array(' ',"\t","\r","\n"), array('','','',''),$item["body"]);
|
$item["body"] = str_replace(array(' ',"\t","\r","\n"), array('','','',''),$item["body"]);
|
||||||
|
@ -2215,18 +2237,13 @@ class dfrn {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$r = q("SELECT `id`, `uid`, `last-child`, `edited`, `body` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
|
|
||||||
dbesc($item["uri"]),
|
|
||||||
intval($importer["importer_uid"])
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!self::process_verbs($entrytype, $importer, $item, $is_like)) {
|
if (!self::process_verbs($entrytype, $importer, $item, $is_like)) {
|
||||||
logger("Exiting because 'process_verbs' told us so", LOGGER_DEBUG);
|
logger("Exiting because 'process_verbs' told us so", LOGGER_DEBUG);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update content if 'updated' changes
|
// Update content if 'updated' changes
|
||||||
if (dbm::is_result($r)) {
|
if (dbm::is_result($current)) {
|
||||||
if (self::update_content($r[0], $item, $importer, $entrytype))
|
if (self::update_content($r[0], $item, $importer, $entrytype))
|
||||||
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
|
logger("Item ".$item["uri"]." was updated.", LOGGER_DEBUG);
|
||||||
else
|
else
|
||||||
|
@ -2311,7 +2328,7 @@ class dfrn {
|
||||||
* @param object $deletion deletion elements
|
* @param object $deletion deletion elements
|
||||||
* @param array $importer Record of the importer user mixed with contact of the content
|
* @param array $importer Record of the importer user mixed with contact of the content
|
||||||
*/
|
*/
|
||||||
private function process_deletion($xpath, $deletion, $importer) {
|
private static function process_deletion($xpath, $deletion, $importer) {
|
||||||
|
|
||||||
logger("Processing deletions");
|
logger("Processing deletions");
|
||||||
|
|
||||||
|
|
|
@ -177,18 +177,6 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
|
||||||
foreach (array_reverse($entrylist) AS $entry) {
|
foreach (array_reverse($entrylist) AS $entry) {
|
||||||
$item = array_merge($header, $author);
|
$item = array_merge($header, $author);
|
||||||
|
|
||||||
$item["title"] = $xpath->evaluate('atom:title/text()', $entry)->item(0)->nodeValue;
|
|
||||||
|
|
||||||
if ($item["title"] == "")
|
|
||||||
$item["title"] = $xpath->evaluate('title/text()', $entry)->item(0)->nodeValue;
|
|
||||||
|
|
||||||
if ($item["title"] == "")
|
|
||||||
$item["title"] = $xpath->evaluate('rss:title/text()', $entry)->item(0)->nodeValue;
|
|
||||||
|
|
||||||
$alternate = $xpath->query("atom:link[@rel='alternate']", $entry)->item(0)->attributes;
|
|
||||||
if (!is_object($alternate))
|
|
||||||
$alternate = $xpath->query("atom:link", $entry)->item(0)->attributes;
|
|
||||||
|
|
||||||
if (is_object($alternate))
|
if (is_object($alternate))
|
||||||
foreach($alternate AS $attributes)
|
foreach($alternate AS $attributes)
|
||||||
if ($attributes->name == "href")
|
if ($attributes->name == "href")
|
||||||
|
@ -212,6 +200,27 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
|
||||||
|
|
||||||
$item["parent-uri"] = $item["uri"];
|
$item["parent-uri"] = $item["uri"];
|
||||||
|
|
||||||
|
if (!$simulate) {
|
||||||
|
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s', '%s')",
|
||||||
|
intval($importer["uid"]), dbesc($item["uri"]), dbesc(NETWORK_FEED), dbesc(NETWORK_DFRN));
|
||||||
|
if ($r) {
|
||||||
|
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$item["title"] = $xpath->evaluate('atom:title/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
if ($item["title"] == "")
|
||||||
|
$item["title"] = $xpath->evaluate('title/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
if ($item["title"] == "")
|
||||||
|
$item["title"] = $xpath->evaluate('rss:title/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
|
$alternate = $xpath->query("atom:link[@rel='alternate']", $entry)->item(0)->attributes;
|
||||||
|
if (!is_object($alternate))
|
||||||
|
$alternate = $xpath->query("atom:link", $entry)->item(0)->attributes;
|
||||||
|
|
||||||
$published = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
|
$published = $xpath->query('atom:published/text()', $entry)->item(0)->nodeValue;
|
||||||
|
|
||||||
if ($published == "")
|
if ($published == "")
|
||||||
|
@ -250,15 +259,6 @@ function feed_import($xml,$importer,&$contact, &$hub, $simulate = false) {
|
||||||
if ($creator != "")
|
if ($creator != "")
|
||||||
$item["author-name"] = $creator;
|
$item["author-name"] = $creator;
|
||||||
|
|
||||||
if (!$simulate) {
|
|
||||||
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' AND `network` IN ('%s', '%s')",
|
|
||||||
intval($importer["uid"]), dbesc($item["uri"]), dbesc(NETWORK_FEED), dbesc(NETWORK_DFRN));
|
|
||||||
if ($r) {
|
|
||||||
logger("Item with uri ".$item["uri"]." for user ".$importer["uid"]." already existed under id ".$r[0]["id"], LOGGER_DEBUG);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @TODO ?
|
/// @TODO ?
|
||||||
// <category>Ausland</category>
|
// <category>Ausland</category>
|
||||||
// <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/>
|
// <media:thumbnail width="152" height="76" url="http://www.taz.de/picture/667875/192/14388767.jpg"/>
|
||||||
|
|
|
@ -143,6 +143,8 @@ function z_fetch_url($url,$binary = false, &$redirects = 0, $opts=array()) {
|
||||||
logger('fetch_url error fetching '.$url.': '.curl_error($ch), LOGGER_NORMAL);
|
logger('fetch_url error fetching '.$url.': '.curl_error($ch), LOGGER_NORMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$ret['errno'] = curl_errno($ch);
|
||||||
|
|
||||||
$base = $s;
|
$base = $s;
|
||||||
$curl_info = @curl_getinfo($ch);
|
$curl_info = @curl_getinfo($ch);
|
||||||
|
|
||||||
|
|
|
@ -48,11 +48,13 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$force = false;
|
$force = false;
|
||||||
$restart = false;
|
$restart = false;
|
||||||
|
|
||||||
if(($argc > 1) && (intval($argv[1])))
|
if (($argc > 1) && (intval($argv[1]))) {
|
||||||
$contact_id = intval($argv[1]);
|
$contact_id = intval($argv[1]);
|
||||||
|
}
|
||||||
|
|
||||||
if(($argc > 2) && ($argv[2] == "force"))
|
if (($argc > 2) && ($argv[2] == "force")) {
|
||||||
$force = true;
|
$force = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (! $contact_id) {
|
if (! $contact_id) {
|
||||||
logger('onepoll: no contact');
|
logger('onepoll: no contact');
|
||||||
|
@ -60,9 +62,11 @@ function onepoll_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
|
|
||||||
// Don't check this stuff if the function is called by the poller
|
// Don't check this stuff if the function is called by the poller
|
||||||
if (App::callstack() != "poller_run")
|
if (App::callstack() != "poller_run") {
|
||||||
if (App::is_already_running('onepoll'.$contact_id, '', 540))
|
if (App::is_already_running('onepoll'.$contact_id, '', 540)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$d = datetime_convert();
|
$d = datetime_convert();
|
||||||
|
|
||||||
|
@ -83,8 +87,9 @@ function onepoll_run(&$argv, &$argc){
|
||||||
intval($contact_id)
|
intval($contact_id)
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! count($contacts))
|
if (! count($contacts)) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$contact = $contacts[0];
|
$contact = $contacts[0];
|
||||||
|
|
||||||
|
@ -94,10 +99,12 @@ function onepoll_run(&$argv, &$argc){
|
||||||
where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
|
where `cid` = %d and updated > UTC_TIMESTAMP() - INTERVAL 1 DAY",
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
if (dbm::is_result($r))
|
if (dbm::is_result($r)) {
|
||||||
if (!$r[0]['total'])
|
if (!$r[0]['total']) {
|
||||||
poco_load($contact['id'],$importer_uid,0,$contact['poco']);
|
poco_load($contact['id'],$importer_uid,0,$contact['poco']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// @TODO Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?)
|
/// @TODO Check why we don't poll the Diaspora feed at the moment (some guid problem in the items?)
|
||||||
/// @TODO Check whether this is possible with Redmatrix
|
/// @TODO Check whether this is possible with Redmatrix
|
||||||
|
@ -132,12 +139,12 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
|
||||||
$hub_update = false;
|
$hub_update = false;
|
||||||
|
|
||||||
if(datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day"))
|
if (datetime_convert('UTC','UTC', 'now') > datetime_convert('UTC','UTC', $t . " + 1 day")) {
|
||||||
$hub_update = true;
|
$hub_update = true;
|
||||||
}
|
}
|
||||||
else
|
} else {
|
||||||
$hub_update = false;
|
$hub_update = false;
|
||||||
|
}
|
||||||
|
|
||||||
$importer_uid = $contact['uid'];
|
$importer_uid = $contact['uid'];
|
||||||
|
|
||||||
|
@ -167,34 +174,44 @@ function onepoll_run(&$argv, &$argc){
|
||||||
if (!update_contact($contact["id"])) {
|
if (!update_contact($contact["id"])) {
|
||||||
mark_for_death($contact);
|
mark_for_death($contact);
|
||||||
return;
|
return;
|
||||||
} else
|
} else {
|
||||||
unmark_for_death($contact);
|
unmark_for_death($contact);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($contact['network'] === NETWORK_DFRN) {
|
if ($contact['network'] === NETWORK_DFRN) {
|
||||||
|
|
||||||
|
|
||||||
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
|
$idtosend = $orig_id = (($contact['dfrn-id']) ? $contact['dfrn-id'] : $contact['issued-id']);
|
||||||
if(intval($contact['duplex']) && $contact['dfrn-id'])
|
if (intval($contact['duplex']) && $contact['dfrn-id']) {
|
||||||
$idtosend = '0:' . $orig_id;
|
$idtosend = '0:' . $orig_id;
|
||||||
if(intval($contact['duplex']) && $contact['issued-id'])
|
}
|
||||||
|
if (intval($contact['duplex']) && $contact['issued-id']) {
|
||||||
$idtosend = '1:' . $orig_id;
|
$idtosend = '1:' . $orig_id;
|
||||||
|
}
|
||||||
|
|
||||||
// they have permission to write to us. We already filtered this in the contact query.
|
// they have permission to write to us. We already filtered this in the contact query.
|
||||||
$perm = 'rw';
|
$perm = 'rw';
|
||||||
|
|
||||||
// But this may be our first communication, so set the writable flag if it isn't set already.
|
// But this may be our first communication, so set the writable flag if it isn't set already.
|
||||||
|
|
||||||
if(! intval($contact['writable']))
|
if (! intval($contact['writable'])) {
|
||||||
q("update contact set writable = 1 where id = %d", intval($contact['id']));
|
q("update contact set writable = 1 where id = %d", intval($contact['id']));
|
||||||
|
}
|
||||||
|
|
||||||
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
$url = $contact['poll'] . '?dfrn_id=' . $idtosend
|
||||||
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
|
. '&dfrn_version=' . DFRN_PROTOCOL_VERSION
|
||||||
. '&type=data&last_update=' . $last_update
|
. '&type=data&last_update=' . $last_update
|
||||||
. '&perm=' . $perm ;
|
. '&perm=' . $perm ;
|
||||||
|
|
||||||
$handshake_xml = fetch_url($url);
|
$ret = z_fetch_url($url);
|
||||||
|
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$handshake_xml = $ret['body'];
|
||||||
|
|
||||||
$html_code = $a->get_curl_code();
|
$html_code = $a->get_curl_code();
|
||||||
|
|
||||||
logger('onepoll: handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
|
logger('onepoll: handshake with url ' . $url . ' returns xml: ' . $handshake_xml, LOGGER_DATA);
|
||||||
|
@ -248,16 +265,14 @@ function onepoll_run(&$argv, &$argc){
|
||||||
intval($contact['id'])
|
intval($contact['id'])
|
||||||
);
|
);
|
||||||
mark_for_death($contact);
|
mark_for_death($contact);
|
||||||
}
|
} elseif ($contact['term-date'] > NULL_DATE) {
|
||||||
else {
|
|
||||||
if ($contact['term-date'] > NULL_DATE) {
|
|
||||||
logger("poller: $url back from the dead - removing mark for death");
|
logger("poller: $url back from the dead - removing mark for death");
|
||||||
unmark_for_death($contact);
|
unmark_for_death($contact);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id)))
|
if ((intval($res->status) != 0) || (! strlen($res->challenge)) || (! strlen($res->dfrn_id))) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
if (((float) $res->dfrn_version > 2.21) && ($contact['poco'] == '')) {
|
||||||
q("update contact set poco = '%s' where id = %d",
|
q("update contact set poco = '%s' where id = %d",
|
||||||
|
@ -276,16 +291,16 @@ function onepoll_run(&$argv, &$argc){
|
||||||
if (($contact['duplex']) && strlen($contact['prvkey'])) {
|
if (($contact['duplex']) && strlen($contact['prvkey'])) {
|
||||||
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
|
openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
|
||||||
openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
|
openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
|
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
|
||||||
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
|
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
|
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
|
||||||
|
|
||||||
if(strpos($final_dfrn_id,':') == 1)
|
if (strpos($final_dfrn_id,':') == 1) {
|
||||||
$final_dfrn_id = substr($final_dfrn_id,2);
|
$final_dfrn_id = substr($final_dfrn_id,2);
|
||||||
|
}
|
||||||
|
|
||||||
if ($final_dfrn_id != $orig_id) {
|
if ($final_dfrn_id != $orig_id) {
|
||||||
logger('poller: ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
|
logger('poller: ID did not decode: ' . $contact['id'] . ' orig: ' . $orig_id . ' final: ' . $final_dfrn_id);
|
||||||
|
@ -299,8 +314,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
|
|
||||||
$xml = post_url($contact['poll'],$postvars);
|
$xml = post_url($contact['poll'],$postvars);
|
||||||
|
|
||||||
}
|
} elseif (($contact['network'] === NETWORK_OSTATUS)
|
||||||
elseif(($contact['network'] === NETWORK_OSTATUS)
|
|
||||||
|| ($contact['network'] === NETWORK_DIASPORA)
|
|| ($contact['network'] === NETWORK_DIASPORA)
|
||||||
|| ($contact['network'] === NETWORK_FEED)) {
|
|| ($contact['network'] === NETWORK_FEED)) {
|
||||||
|
|
||||||
|
@ -311,8 +325,9 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0);
|
$stat_writeable = ((($contact['notify']) && ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['rel'] == CONTACT_IS_FRIEND)) ? 1 : 0);
|
||||||
|
|
||||||
// Contacts from OStatus are always writable
|
// Contacts from OStatus are always writable
|
||||||
if($contact['network'] === NETWORK_OSTATUS)
|
if ($contact['network'] === NETWORK_OSTATUS) {
|
||||||
$stat_writeable = 1;
|
$stat_writeable = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if ($stat_writeable != $contact['writable']) {
|
if ($stat_writeable != $contact['writable']) {
|
||||||
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d",
|
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d",
|
||||||
|
@ -323,14 +338,21 @@ function onepoll_run(&$argv, &$argc){
|
||||||
|
|
||||||
// Are we allowed to import from this person?
|
// Are we allowed to import from this person?
|
||||||
|
|
||||||
if($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly'])
|
if ($contact['rel'] == CONTACT_IS_FOLLOWER || $contact['blocked'] || $contact['readonly']) {
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
|
$cookiejar = tempnam(get_temppath(), 'cookiejar-onepoll-');
|
||||||
$xml = fetch_url($contact['poll'], false, $redirects, 0, Null, $cookiejar);
|
$ret = z_fetch_url($contact['poll'], false, $redirects, array('cookiejar' => $cookiejar));
|
||||||
unlink($cookiejar);
|
|
||||||
|
if ($ret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
elseif($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) {
|
|
||||||
|
$xml = $ret['body'];
|
||||||
|
|
||||||
|
unlink($cookiejar);
|
||||||
|
} elseif ($contact['network'] === NETWORK_MAIL || $contact['network'] === NETWORK_MAIL2) {
|
||||||
|
|
||||||
logger("Mail: Fetching", LOGGER_DEBUG);
|
logger("Mail: Fetching", LOGGER_DEBUG);
|
||||||
|
|
||||||
|
@ -361,9 +383,10 @@ function onepoll_run(&$argv, &$argc){
|
||||||
intval($importer_uid)
|
intval($importer_uid)
|
||||||
);
|
);
|
||||||
logger("Mail: Connected to " . $mailconf[0]['user']);
|
logger("Mail: Connected to " . $mailconf[0]['user']);
|
||||||
} else
|
} else {
|
||||||
logger("Mail: Connection error ".$mailconf[0]['user']." ".print_r(imap_errors(), true));
|
logger("Mail: Connection error ".$mailconf[0]['user']." ".print_r(imap_errors(), true));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if ($mbox) {
|
if ($mbox) {
|
||||||
|
|
||||||
$msgs = email_poll($mbox,$contact['addr']);
|
$msgs = email_poll($mbox,$contact['addr']);
|
||||||
|
@ -374,8 +397,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
$metas = email_msg_meta($mbox,implode(',',$msgs));
|
$metas = email_msg_meta($mbox,implode(',',$msgs));
|
||||||
if (count($metas) != count($msgs)) {
|
if (count($metas) != count($msgs)) {
|
||||||
logger("onepoll: for " . $mailconf[0]['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG);
|
logger("onepoll: for " . $mailconf[0]['user'] . " there are ". count($msgs) . " messages but received " . count($metas) . " metas", LOGGER_DEBUG);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
$msgs = array_combine($msgs, $metas);
|
$msgs = array_combine($msgs, $metas);
|
||||||
|
|
||||||
foreach ($msgs as $msg_uid => $meta) {
|
foreach ($msgs as $msg_uid => $meta) {
|
||||||
|
@ -456,12 +478,13 @@ function onepoll_run(&$argv, &$argc){
|
||||||
// Decoding the header
|
// Decoding the header
|
||||||
$subject = imap_mime_header_decode($meta->subject);
|
$subject = imap_mime_header_decode($meta->subject);
|
||||||
$datarray['title'] = "";
|
$datarray['title'] = "";
|
||||||
foreach($subject as $subpart)
|
foreach ($subject as $subpart) {
|
||||||
if ($subpart->charset != "default")
|
if ($subpart->charset != "default") {
|
||||||
$datarray['title'] .= iconv($subpart->charset, 'UTF-8//IGNORE', $subpart->text);
|
$datarray['title'] .= iconv($subpart->charset, 'UTF-8//IGNORE', $subpart->text);
|
||||||
else
|
} else {
|
||||||
$datarray['title'] .= $subpart->text;
|
$datarray['title'] .= $subpart->text;
|
||||||
|
}
|
||||||
|
}
|
||||||
$datarray['title'] = notags(trim($datarray['title']));
|
$datarray['title'] = notags(trim($datarray['title']));
|
||||||
|
|
||||||
//$datarray['title'] = notags(trim($meta->subject));
|
//$datarray['title'] = notags(trim($meta->subject));
|
||||||
|
@ -505,20 +528,23 @@ function onepoll_run(&$argv, &$argc){
|
||||||
if (! stristr($meta->from,$contact['addr'])) {
|
if (! stristr($meta->from,$contact['addr'])) {
|
||||||
$from = imap_mime_header_decode($meta->from);
|
$from = imap_mime_header_decode($meta->from);
|
||||||
$fromdecoded = "";
|
$fromdecoded = "";
|
||||||
foreach($from as $frompart)
|
foreach ($from as $frompart) {
|
||||||
if ($frompart->charset != "default")
|
if ($frompart->charset != "default") {
|
||||||
$fromdecoded .= iconv($frompart->charset, 'UTF-8//IGNORE', $frompart->text);
|
$fromdecoded .= iconv($frompart->charset, 'UTF-8//IGNORE', $frompart->text);
|
||||||
else
|
} else {
|
||||||
$fromdecoded .= $frompart->text;
|
$fromdecoded .= $frompart->text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->get_hostname());
|
$fromarr = imap_rfc822_parse_adrlist($fromdecoded, $a->get_hostname());
|
||||||
|
|
||||||
$frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host;
|
$frommail = $fromarr[0]->mailbox."@".$fromarr[0]->host;
|
||||||
|
|
||||||
if (isset($fromarr[0]->personal))
|
if (isset($fromarr[0]->personal)) {
|
||||||
$fromname = $fromarr[0]->personal;
|
$fromname = $fromarr[0]->personal;
|
||||||
else
|
} else {
|
||||||
$fromname = $frommail;
|
$fromname = $frommail;
|
||||||
|
}
|
||||||
|
|
||||||
//$datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body'];
|
//$datarray['body'] = "[b]".t('From: ') . escape_tags($fromdecoded) . "[/b]\n\n" . $datarray['body'];
|
||||||
|
|
||||||
|
@ -574,14 +600,14 @@ function onepoll_run(&$argv, &$argc){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else
|
} else {
|
||||||
logger("Mail: no mails for ".$mailconf[0]['user']);
|
logger("Mail: no mails for ".$mailconf[0]['user']);
|
||||||
|
}
|
||||||
|
|
||||||
logger("Mail: closing connection for ".$mailconf[0]['user']);
|
logger("Mail: closing connection for ".$mailconf[0]['user']);
|
||||||
imap_close($mbox);
|
imap_close($mbox);
|
||||||
}
|
}
|
||||||
}
|
} elseif ($contact['network'] === NETWORK_FACEBOOK) {
|
||||||
elseif($contact['network'] === NETWORK_FACEBOOK) {
|
|
||||||
// This is picked up by the Facebook plugin on a cron hook.
|
// This is picked up by the Facebook plugin on a cron hook.
|
||||||
// Ignored here.
|
// Ignored here.
|
||||||
} elseif ($contact['network'] === NETWORK_PUMPIO) {
|
} elseif ($contact['network'] === NETWORK_PUMPIO) {
|
||||||
|
@ -628,8 +654,9 @@ function onepoll_run(&$argv, &$argc){
|
||||||
if (count($hubs)) {
|
if (count($hubs)) {
|
||||||
foreach ($hubs as $h) {
|
foreach ($hubs as $h) {
|
||||||
$h = trim($h);
|
$h = trim($h);
|
||||||
if(! strlen($h))
|
if (! strlen($h)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
subscribe_to_hub($h,$importer,$contact,$hubmode);
|
subscribe_to_hub($h,$importer,$contact,$hubmode);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -207,6 +207,16 @@ function poller_exec_function($queue, $funcname, $argv) {
|
||||||
|
|
||||||
$duration = number_format(microtime(true) - $stamp, 3);
|
$duration = number_format(microtime(true) - $stamp, 3);
|
||||||
|
|
||||||
|
if ($duration > 3600) {
|
||||||
|
logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 1 hour (".round($duration/60, 3).")", LOGGER_DEBUG);
|
||||||
|
} elseif ($duration > 600) {
|
||||||
|
logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 10 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
|
||||||
|
} elseif ($duration > 300) {
|
||||||
|
logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 5 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
|
||||||
|
} elseif ($duration > 120) {
|
||||||
|
logger("Prio ".$queue["priority"].": ".$queue["parameter"]." - longer than 2 minutes (".round($duration/60, 3).")", LOGGER_DEBUG);
|
||||||
|
}
|
||||||
|
|
||||||
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds.");
|
logger("Process ".$mypid." - Prio ".$queue["priority"]." - ID ".$queue["id"].": ".$funcname." - done in ".$duration." seconds.");
|
||||||
|
|
||||||
// Write down the performance values into the log
|
// Write down the performance values into the log
|
||||||
|
|
|
@ -5,6 +5,7 @@ use \Friendica\Core\Config;
|
||||||
require_once("boot.php");
|
require_once("boot.php");
|
||||||
require_once('include/queue_fn.php');
|
require_once('include/queue_fn.php');
|
||||||
require_once('include/dfrn.php');
|
require_once('include/dfrn.php');
|
||||||
|
require_once('include/cache.php');
|
||||||
|
|
||||||
function queue_run(&$argv, &$argc){
|
function queue_run(&$argv, &$argc){
|
||||||
global $a, $db;
|
global $a, $db;
|
||||||
|
@ -37,14 +38,14 @@ function queue_run(&$argv, &$argc){
|
||||||
|
|
||||||
load_hooks();
|
load_hooks();
|
||||||
|
|
||||||
if($argc > 1)
|
if ($argc > 1) {
|
||||||
$queue_id = intval($argv[1]);
|
$queue_id = intval($argv[1]);
|
||||||
else
|
} else {
|
||||||
$queue_id = 0;
|
$queue_id = 0;
|
||||||
|
}
|
||||||
|
|
||||||
$deadguys = array();
|
$cachekey_deadguy = 'queue_run:deadguy:';
|
||||||
$deadservers = array();
|
$cachekey_server = 'queue_run:server:';
|
||||||
$serverlist = array();
|
|
||||||
|
|
||||||
if (!$queue_id) {
|
if (!$queue_id) {
|
||||||
|
|
||||||
|
@ -111,10 +112,10 @@ function queue_run(&$argv, &$argc){
|
||||||
// queue_predeliver hooks may have changed the queue db details,
|
// queue_predeliver hooks may have changed the queue db details,
|
||||||
// so check again if this entry still needs processing
|
// so check again if this entry still needs processing
|
||||||
|
|
||||||
if($queue_id)
|
if ($queue_id) {
|
||||||
$qi = q("SELECT * FROM `queue` WHERE `id` = %d LIMIT 1",
|
$qi = q("SELECT * FROM `queue` WHERE `id` = %d LIMIT 1",
|
||||||
intval($queue_id));
|
intval($queue_id));
|
||||||
elseif (get_config("system", "worker")) {
|
} elseif (get_config("system", "worker")) {
|
||||||
logger('Call queue for id '.$q_item['id']);
|
logger('Call queue for id '.$q_item['id']);
|
||||||
proc_run(PRIORITY_LOW, "include/queue.php", $q_item['id']);
|
proc_run(PRIORITY_LOW, "include/queue.php", $q_item['id']);
|
||||||
continue;
|
continue;
|
||||||
|
@ -122,8 +123,9 @@ function queue_run(&$argv, &$argc){
|
||||||
$qi = q("SELECT * FROM `queue` WHERE `id` = %d AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ",
|
$qi = q("SELECT * FROM `queue` WHERE `id` = %d AND `last` < UTC_TIMESTAMP() - INTERVAL 15 MINUTE ",
|
||||||
intval($q_item['id']));
|
intval($q_item['id']));
|
||||||
|
|
||||||
if(! count($qi))
|
if (!dbm::is_result($qi)) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
$c = q("SELECT * FROM `contact` WHERE `id` = %d LIMIT 1",
|
||||||
|
@ -133,7 +135,10 @@ function queue_run(&$argv, &$argc){
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(in_array($c[0]['notify'],$deadguys)) {
|
|
||||||
|
$dead = Cache::get($cachekey_deadguy.$c[0]['notify']);
|
||||||
|
|
||||||
|
if (!is_null($dead) AND $dead) {
|
||||||
logger('queue: skipping known dead url: '.$c[0]['notify']);
|
logger('queue: skipping known dead url: '.$c[0]['notify']);
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
continue;
|
continue;
|
||||||
|
@ -141,19 +146,22 @@ function queue_run(&$argv, &$argc){
|
||||||
|
|
||||||
$server = poco_detect_server($c[0]['url']);
|
$server = poco_detect_server($c[0]['url']);
|
||||||
|
|
||||||
if (($server != "") AND !in_array($server, $serverlist)) {
|
if ($server != "") {
|
||||||
logger("Check server ".$server." (".$c[0]["network"].")");
|
$vital = Cache::get($cachekey_server.$server);
|
||||||
if (!poco_check_server($server, $c[0]["network"], true))
|
|
||||||
$deadservers[] = $server;
|
|
||||||
|
|
||||||
$serverlist[] = $server;
|
if (is_null($vital)) {
|
||||||
|
logger("Check server ".$server." (".$c[0]["network"].")");
|
||||||
|
|
||||||
|
$vital = poco_check_server($server, $c[0]["network"], true);
|
||||||
|
Cache::set($cachekey_server.$server, $vital, CACHE_QUARTER_HOUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($server != "") AND in_array($server, $deadservers)) {
|
if (!is_null($vital) AND !$vital) {
|
||||||
logger('queue: skipping known dead server: '.$server);
|
logger('queue: skipping dead server: '.$server);
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$u = q("SELECT `user`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`
|
$u = q("SELECT `user`.*, `user`.`pubkey` AS `upubkey`, `user`.`prvkey` AS `uprvkey`
|
||||||
FROM `user` WHERE `uid` = %d LIMIT 1",
|
FROM `user` WHERE `uid` = %d LIMIT 1",
|
||||||
|
@ -176,12 +184,12 @@ function queue_run(&$argv, &$argc){
|
||||||
logger('queue: dfrndelivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
|
logger('queue: dfrndelivery: item '.$q_item['id'].' for '.$contact['name'].' <'.$contact['url'].'>');
|
||||||
$deliver_status = dfrn::deliver($owner,$contact,$data);
|
$deliver_status = dfrn::deliver($owner,$contact,$data);
|
||||||
|
|
||||||
if($deliver_status == (-1)) {
|
if ($deliver_status < 0) {
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
$deadguys[] = $contact['notify'];
|
Cache::set($cachekey_deadguy.$contact['notify'], true, CACHE_QUARTER_HOUR);
|
||||||
} else
|
} else {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NETWORK_OSTATUS:
|
case NETWORK_OSTATUS:
|
||||||
if ($contact['notify']) {
|
if ($contact['notify']) {
|
||||||
|
@ -190,10 +198,11 @@ function queue_run(&$argv, &$argc){
|
||||||
|
|
||||||
if ($deliver_status == (-1)) {
|
if ($deliver_status == (-1)) {
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
$deadguys[] = $contact['notify'];
|
Cache::set($cachekey_deadguy.$contact['notify'], true, CACHE_QUARTER_HOUR);
|
||||||
} else
|
} else {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case NETWORK_DIASPORA:
|
case NETWORK_DIASPORA:
|
||||||
if ($contact['notify']) {
|
if ($contact['notify']) {
|
||||||
|
@ -202,10 +211,10 @@ function queue_run(&$argv, &$argc){
|
||||||
|
|
||||||
if ($deliver_status == (-1)) {
|
if ($deliver_status == (-1)) {
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
$deadguys[] = $contact['notify'];
|
Cache::set($cachekey_deadguy.$contact['notify'], true, CACHE_QUARTER_HOUR);
|
||||||
} else
|
} else {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -213,15 +222,15 @@ function queue_run(&$argv, &$argc){
|
||||||
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
|
$params = array('owner' => $owner, 'contact' => $contact, 'queue' => $q_item, 'result' => false);
|
||||||
call_hooks('queue_deliver', $a, $params);
|
call_hooks('queue_deliver', $a, $params);
|
||||||
|
|
||||||
if($params['result'])
|
if ($params['result']) {
|
||||||
remove_queue_item($q_item['id']);
|
remove_queue_item($q_item['id']);
|
||||||
else
|
} else {
|
||||||
update_queue_time($q_item['id']);
|
update_queue_time($q_item['id']);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
}
|
}
|
||||||
logger('Deliver status '.$deliver_status.' for item '.$q_item['id'].' to '.$contact['name'].' <'.$contact['url'].'>');
|
logger('Deliver status '.(int)$deliver_status.' for item '.$q_item['id'].' to '.$contact['name'].' <'.$contact['url'].'>');
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -690,7 +690,7 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$servers = q("SELECT * FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
|
$servers = q("SELECT * FROM `gserver` WHERE `nurl` = '%s'", dbesc(normalise_link($server_url)));
|
||||||
if ($servers) {
|
if (dbm::is_result($servers)) {
|
||||||
|
|
||||||
if ($servers[0]["created"] <= NULL_DATE)
|
if ($servers[0]["created"] <= NULL_DATE)
|
||||||
q("UPDATE `gserver` SET `created` = '%s' WHERE `nurl` = '%s'",
|
q("UPDATE `gserver` SET `created` = '%s' WHERE `nurl` = '%s'",
|
||||||
|
@ -732,21 +732,40 @@ function poco_check_server($server_url, $network = "", $force = false) {
|
||||||
$orig_last_failure = $last_failure;
|
$orig_last_failure = $last_failure;
|
||||||
|
|
||||||
// Check if the page is accessible via SSL.
|
// Check if the page is accessible via SSL.
|
||||||
|
$orig_server_url = $server_url;
|
||||||
$server_url = str_replace("http://", "https://", $server_url);
|
$server_url = str_replace("http://", "https://", $server_url);
|
||||||
$serverret = z_fetch_url($server_url."/.well-known/host-meta");
|
|
||||||
|
// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
|
||||||
|
$serverret = z_fetch_url($server_url."/.well-known/host-meta", false, $redirects, array('timeout' => 20));
|
||||||
|
|
||||||
|
// Quit if there is a timeout.
|
||||||
|
// But we want to make sure to only quit if we are mostly sure that this server url fits.
|
||||||
|
if (dbm::is_result($servers) AND ($orig_server_url == $server_url) AND
|
||||||
|
($serverret['errno'] == CURLE_OPERATION_TIMEDOUT)) {
|
||||||
|
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Maybe the page is unencrypted only?
|
// Maybe the page is unencrypted only?
|
||||||
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
||||||
if (!$serverret["success"] OR ($serverret["body"] == "") OR (@sizeof($xmlobj) == 0) OR !is_object($xmlobj)) {
|
if (!$serverret["success"] OR ($serverret["body"] == "") OR (@sizeof($xmlobj) == 0) OR !is_object($xmlobj)) {
|
||||||
$server_url = str_replace("https://", "http://", $server_url);
|
$server_url = str_replace("https://", "http://", $server_url);
|
||||||
$serverret = z_fetch_url($server_url."/.well-known/host-meta");
|
|
||||||
|
// We set the timeout to 20 seconds since this operation should be done in no time if the server was vital
|
||||||
|
$serverret = z_fetch_url($server_url."/.well-known/host-meta", false, $redirects, array('timeout' => 20));
|
||||||
|
|
||||||
|
// Quit if there is a timeout
|
||||||
|
if ($serverret['errno'] == CURLE_OPERATION_TIMEDOUT) {
|
||||||
|
logger("Connection to server ".$server_url." timed out.", LOGGER_DEBUG);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
$xmlobj = @simplexml_load_string($serverret["body"],'SimpleXMLElement',0, "http://docs.oasis-open.org/ns/xri/xrd-1.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$serverret["success"] OR ($serverret["body"] == "") OR (sizeof($xmlobj) == 0) OR !is_object($xmlobj)) {
|
if (!$serverret["success"] OR ($serverret["body"] == "") OR (sizeof($xmlobj) == 0) OR !is_object($xmlobj)) {
|
||||||
// Workaround for bad configured servers (known nginx problem)
|
// Workaround for bad configured servers (known nginx problem)
|
||||||
if ($serverret["debug"]["http_code"] != "403") {
|
if (!in_array($serverret["debug"]["http_code"], array("403", "404"))) {
|
||||||
$last_failure = datetime_convert();
|
$last_failure = datetime_convert();
|
||||||
$failure = true;
|
$failure = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -228,9 +228,10 @@ function nodeinfo_cron() {
|
||||||
|
|
||||||
logger("local_posts: ".$local_posts, LOGGER_DEBUG);
|
logger("local_posts: ".$local_posts, LOGGER_DEBUG);
|
||||||
|
|
||||||
$posts = qu("SELECT COUNT(*) AS `local_comments` FROM `item`
|
$posts = qu("SELECT COUNT(*) FROM `contact`
|
||||||
INNER JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
INNER JOIN `item` ON `item`.`contact-id` = `contact`.`id` AND `item`.`uid` = `contact`.`uid` AND
|
||||||
WHERE `contact`.`self` and `item`.`id` != `item`.`parent` AND `item`.`network` IN ('%s', '%s', '%s')",
|
`item`.`id` != `item`.`parent` AND `item`.`network` IN ('%s', '%s', '%s')
|
||||||
|
WHERE `contact`.`self`",
|
||||||
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN));
|
dbesc(NETWORK_OSTATUS), dbesc(NETWORK_DIASPORA), dbesc(NETWORK_DFRN));
|
||||||
|
|
||||||
if (!is_array($posts))
|
if (!is_array($posts))
|
||||||
|
|
|
@ -194,10 +194,14 @@ function notifications_content(App $a) {
|
||||||
if($it['network'] === NETWORK_DFRN) {
|
if($it['network'] === NETWORK_DFRN) {
|
||||||
$lbl_knowyou = t('Claims to be known to you: ');
|
$lbl_knowyou = t('Claims to be known to you: ');
|
||||||
$knowyou = (($it['knowyou']) ? t('yes') : t('no'));
|
$knowyou = (($it['knowyou']) ? t('yes') : t('no'));
|
||||||
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Fan/Admirer" means that you allow to read but you do not want to read theirs. Approve as: ');
|
$helptext = t('Shall your connection be bidirectional or not?');
|
||||||
|
$helptext2 = sprintf(t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.'), $it['name'], $it['name']);
|
||||||
|
$helptext3 = sprintf(t('Accepting %s as a subscriber allows them to subscribe to your posts, but you will not receive updates from them in your news feed.'), $it['name']);
|
||||||
} else {
|
} else {
|
||||||
$knowyou = '';
|
$knowyou = '';
|
||||||
$helptext = t('Shall your connection be bidirectional or not? "Friend" implies that you allow to read and you subscribe to their posts. "Sharer" means that you allow to read but you do not want to read theirs. Approve as: ');
|
$helptext = t('Shall your connection be bidirectional or not?');
|
||||||
|
$helptext2 = sprintf(t('Accepting %s as a friend allows %s to subscribe to your posts, and you will also receive updates from them in your news feed.'), $it['name'], $it['name']);
|
||||||
|
$helptext3 = sprintf(t('Accepting %s as a sharer allows them to subscribe to your posts, but you will not receive updates from them in your news feed.'), $it['name']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,9 +209,11 @@ function notifications_content(App $a) {
|
||||||
'$intro_id' => $it['intro_id'],
|
'$intro_id' => $it['intro_id'],
|
||||||
'$friend_selected' => $friend_selected,
|
'$friend_selected' => $friend_selected,
|
||||||
'$fan_selected' => $fan_selected,
|
'$fan_selected' => $fan_selected,
|
||||||
'$approve_as' => $helptext,
|
'$approve_as1' => $helptext,
|
||||||
|
'$approve_as2' => $helptext2,
|
||||||
|
'$approve_as3' => $helptext3,
|
||||||
'$as_friend' => t('Friend'),
|
'$as_friend' => t('Friend'),
|
||||||
'$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Fan/Admirer'))
|
'$as_fan' => (($it['network'] == NETWORK_DIASPORA) ? t('Sharer') : t('Subscriber'))
|
||||||
));
|
));
|
||||||
|
|
||||||
$header = $it["name"];
|
$header = $it["name"];
|
||||||
|
|
|
@ -240,6 +240,17 @@ function profile_content(App $a, $update = 0) {
|
||||||
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
|
$sql_extra2 .= protect_sprintf(sprintf(" AND `thread`.`created` >= '%s' ", dbesc(datetime_convert(date_default_timezone_get(),'',$datequery2))));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Belongs the profile page to a forum?
|
||||||
|
// If not then we can improve the performance with an additional condition
|
||||||
|
$r = q("SELECT `uid` FROM `user` WHERE `uid` = %d AND `page-flags` IN (%d, %d)",
|
||||||
|
intval($a->profile['profile_uid']),
|
||||||
|
intval(PAGE_COMMUNITY),
|
||||||
|
intval(PAGE_PRVGROUP));
|
||||||
|
|
||||||
|
if (!dbm::is_result($r)) {
|
||||||
|
$sql_extra3 = sprintf(" AND `thread`.`contact-id` = %d ", intval(intval($a->profile['contact_id'])));
|
||||||
|
}
|
||||||
|
|
||||||
if(get_config('system', 'old_pager')) {
|
if(get_config('system', 'old_pager')) {
|
||||||
$r = q("SELECT COUNT(*) AS `total`
|
$r = q("SELECT COUNT(*) AS `total`
|
||||||
FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
FROM `thread` INNER JOIN `item` ON `item`.`id` = `thread`.`iid`
|
||||||
|
@ -248,7 +259,7 @@ function profile_content(App $a, $update = 0) {
|
||||||
WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
|
WHERE `thread`.`uid` = %d AND `thread`.`visible` = 1 AND `thread`.`deleted` = 0
|
||||||
and `thread`.`moderated` = 0
|
and `thread`.`moderated` = 0
|
||||||
AND `thread`.`wall` = 1
|
AND `thread`.`wall` = 1
|
||||||
$sql_extra $sql_extra2 ",
|
$sql_extra3 $sql_extra $sql_extra2 ",
|
||||||
intval($a->profile['profile_uid'])
|
intval($a->profile['profile_uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -282,14 +293,12 @@ function profile_content(App $a, $update = 0) {
|
||||||
STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
STRAIGHT_JOIN `contact` ON `contact`.`id` = `thread`.`contact-id`
|
||||||
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
AND NOT `contact`.`blocked` AND NOT `contact`.`pending`
|
||||||
WHERE `thread`.`uid` = %d AND `thread`.`visible`
|
WHERE `thread`.`uid` = %d AND `thread`.`visible`
|
||||||
AND `thread`.`contact-id` = %d
|
|
||||||
AND NOT `thread`.`deleted`
|
AND NOT `thread`.`deleted`
|
||||||
AND NOT `thread`.`moderated`
|
AND NOT `thread`.`moderated`
|
||||||
AND `thread`.`wall`
|
AND `thread`.`wall`
|
||||||
$sql_extra $sql_extra2
|
$sql_extra3 $sql_extra $sql_extra2
|
||||||
ORDER BY `thread`.`created` DESC $pager_sql",
|
ORDER BY `thread`.`created` DESC $pager_sql",
|
||||||
intval($a->profile['profile_uid']),
|
intval($a->profile['profile_uid'])
|
||||||
intval($a->profile['contact_id'])
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('UPDATE_VERSION' , 1214);
|
define('UPDATE_VERSION' , 1215);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
11850
util/messages.po
11850
util/messages.po
File diff suppressed because it is too large
Load diff
12016
view/lang/de/messages.po
12016
view/lang/de/messages.po
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,5 +1,9 @@
|
||||||
|
|
||||||
<div class="intro-approve-as-friend-desc">{{$approve_as}}</div>
|
<div class="intro-approve-as-friend-desc">
|
||||||
|
<p>{{$approve_as1}}</p>
|
||||||
|
<p>{{$approve_as2}}</p>
|
||||||
|
<p>{{$approve_as3}}</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="intro-approve-as-friend-wrapper">
|
<div class="intro-approve-as-friend-wrapper">
|
||||||
<label class="intro-approve-as-friend-label" for="intro-approve-as-friend-{{$intro_id}}">{{$as_friend}}</label>
|
<label class="intro-approve-as-friend-label" for="intro-approve-as-friend-{{$intro_id}}">{{$as_friend}}</label>
|
||||||
|
|
|
@ -4,8 +4,9 @@
|
||||||
|
|
||||||
// Catch the GUID from the URL
|
// Catch the GUID from the URL
|
||||||
var itemGuid = window.location.pathname.split("/").pop();
|
var itemGuid = window.location.pathname.split("/").pop();
|
||||||
|
var itemGuidSafe = itemGuid.replace(/%.*/, '');
|
||||||
|
|
||||||
$(window).load(function(){
|
$(window).load(function(){
|
||||||
// Scroll to the Item by its GUID
|
// Scroll to the Item by its GUID
|
||||||
scrollToItem('item-'+itemGuid);
|
scrollToItem('item-' + itemGuidSafe);
|
||||||
});
|
});
|
||||||
|
|
|
@ -68,9 +68,9 @@ as the value of $top_child_total (this is done at the end of this file)
|
||||||
|
|
||||||
{{* Use a different div container in dependence max thread-level = 7 *}}
|
{{* Use a different div container in dependence max thread-level = 7 *}}
|
||||||
{{if $item.thread_level<7}}
|
{{if $item.thread_level<7}}
|
||||||
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_{{$item.thread_level}} {{if $item.thread_level==1}}panel-body h-entry{{else}}u-comment h-cite{{/if}}" id="item-{{$item.guid}}"><!-- wall-item-container -->
|
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_{{$item.thread_level}} {{if $item.thread_level==1}}panel-body h-entry{{else}}u-comment h-cite{{/if}}" id="item-{{$item.guid|regex_replace:'/%.*/':''}}"><!-- wall-item-container -->
|
||||||
{{else}}
|
{{else}}
|
||||||
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_7 u-comment h-cite" id="item-{{$item.guid}}">
|
<div class="wall-item-container {{$item.indent}} {{$item.shiny}} {{$item.network}} thread_level_7 u-comment h-cite" id="item-{{$item.guid|regex_replace:'/%.*/':''}}">
|
||||||
{{/if}}
|
{{/if}}
|
||||||
<div class="media">
|
<div class="media">
|
||||||
{{* Put addional actions in a top-right dropdown menu *}}
|
{{* Put addional actions in a top-right dropdown menu *}}
|
||||||
|
|
Loading…
Reference in a new issue