mirror of
https://github.com/friendica/friendica
synced 2025-04-25 04:30:11 +00:00
added spaces + some curly braces + some usage of dbm::is_result()
Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
parent
2ef3251293
commit
1dc4b60a5a
9 changed files with 111 additions and 93 deletions
|
@ -57,8 +57,9 @@ function block_on_function_lock($fn_name, $wait_sec = 2, $timeout = 30) {
|
||||||
dbesc($fn_name)
|
dbesc($fn_name)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (dbm::is_result($r) && $r[0]['locked'])
|
if (dbm::is_result($r) && $r[0]['locked']) {
|
||||||
sleep($wait_sec);
|
sleep($wait_sec);
|
||||||
|
}
|
||||||
|
|
||||||
} while (dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
|
} while (dbm::is_result($r) && $r[0]['locked'] && ((time() - $start) < $timeout));
|
||||||
|
|
||||||
|
|
|
@ -497,14 +497,15 @@ function allowed_url($url) {
|
||||||
*/
|
*/
|
||||||
function allowed_email($email) {
|
function allowed_email($email) {
|
||||||
|
|
||||||
|
|
||||||
$domain = strtolower(substr($email,strpos($email,'@') + 1));
|
$domain = strtolower(substr($email,strpos($email,'@') + 1));
|
||||||
if(! $domain)
|
if (! $domain) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$str_allowed = get_config('system','allowed_email');
|
$str_allowed = get_config('system','allowed_email');
|
||||||
if(! $str_allowed)
|
if (! $str_allowed) {
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
$found = false;
|
$found = false;
|
||||||
|
|
||||||
|
|
|
@ -305,7 +305,9 @@ function oembed_html2bbcode($text) {
|
||||||
$xattr = "@rel='oembed'";//oe_build_xpath("rel","oembed");
|
$xattr = "@rel='oembed'";//oe_build_xpath("rel","oembed");
|
||||||
foreach ($entries as $e) {
|
foreach ($entries as $e) {
|
||||||
$href = $xpath->evaluate("a[$xattr]/@href", $e)->item(0)->nodeValue;
|
$href = $xpath->evaluate("a[$xattr]/@href", $e)->item(0)->nodeValue;
|
||||||
if(!is_null($href)) $e->parentNode->replaceChild(new DOMText("[embed]".$href."[/embed]"), $e);
|
if (!is_null($href)) {
|
||||||
|
$e->parentNode->replaceChild(new DOMText("[embed]".$href."[/embed]"), $e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return oe_get_inner_html( $dom->getElementsByTagName("body")->item(0) );
|
return oe_get_inner_html( $dom->getElementsByTagName("body")->item(0) );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -170,7 +170,7 @@ function onepoll_run(&$argv, &$argc){
|
||||||
// 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
|
||||||
|
@ -437,17 +437,19 @@ function onepoll_run(&$argv, &$argc){
|
||||||
if ($raw_refs) {
|
if ($raw_refs) {
|
||||||
$refs_arr = explode(' ', $raw_refs);
|
$refs_arr = explode(' ', $raw_refs);
|
||||||
if (count($refs_arr)) {
|
if (count($refs_arr)) {
|
||||||
for($x = 0; $x < count($refs_arr); $x ++)
|
for ($x = 0; $x < count($refs_arr); $x ++) {
|
||||||
$refs_arr[$x] = "'" . msgid2iri(str_replace(array('<','>',' '),array('','',''),dbesc($refs_arr[$x]))) . "'";
|
$refs_arr[$x] = "'" . msgid2iri(str_replace(array('<','>',' '),array('','',''),dbesc($refs_arr[$x]))) . "'";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
$qstr = implode(',',$refs_arr);
|
$qstr = implode(',',$refs_arr);
|
||||||
$r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1",
|
$r = q("SELECT `uri` , `parent-uri` FROM `item` USE INDEX (`uid_uri`) WHERE `uri` IN ($qstr) AND `uid` = %d LIMIT 1",
|
||||||
intval($importer_uid)
|
intval($importer_uid)
|
||||||
);
|
);
|
||||||
if (dbm::is_result($r))
|
if (dbm::is_result($r)) {
|
||||||
$datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
|
$datarray['parent-uri'] = $r[0]['parent-uri']; // Set the parent as the top-level item
|
||||||
//$datarray['parent-uri'] = $r[0]['uri'];
|
//$datarray['parent-uri'] = $r[0]['uri'];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Decoding the header
|
// Decoding the header
|
||||||
$subject = imap_mime_header_decode($meta->subject);
|
$subject = imap_mime_header_decode($meta->subject);
|
||||||
|
@ -611,14 +613,17 @@ function onepoll_run(&$argv, &$argc){
|
||||||
consume_feed($xml,$importer,$contact,$hub,1,2);
|
consume_feed($xml,$importer,$contact,$hub,1,2);
|
||||||
|
|
||||||
$hubmode = 'subscribe';
|
$hubmode = 'subscribe';
|
||||||
if ($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly'])
|
if ($contact['network'] === NETWORK_DFRN || $contact['blocked'] || $contact['readonly']) {
|
||||||
$hubmode = 'unsubscribe';
|
$hubmode = 'unsubscribe';
|
||||||
|
}
|
||||||
|
|
||||||
if (($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify']))
|
if (($contact['network'] === NETWORK_OSTATUS || $contact['network'] == NETWORK_FEED) && (! $contact['hub-verify'])) {
|
||||||
$hub_update = true;
|
$hub_update = true;
|
||||||
|
}
|
||||||
|
|
||||||
if ($force)
|
if ($force) {
|
||||||
$hub_update = true;
|
$hub_update = true;
|
||||||
|
}
|
||||||
|
|
||||||
logger("Contact ".$contact['id']." returned hub: ".$hub." Network: ".$contact['network']." Relation: ".$contact['rel']." Update: ".$hub_update);
|
logger("Contact ".$contact['id']." returned hub: ".$hub." Network: ".$contact['network']." Relation: ".$contact['rel']." Update: ".$hub_update);
|
||||||
|
|
||||||
|
|
|
@ -83,19 +83,23 @@ class ostatus {
|
||||||
$aliaslink = $author["author-link"];
|
$aliaslink = $author["author-link"];
|
||||||
|
|
||||||
$alternate = $xpath->query("atom:author/atom:link[@rel='alternate']", $context)->item(0)->attributes;
|
$alternate = $xpath->query("atom:author/atom:link[@rel='alternate']", $context)->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") {
|
||||||
$author["author-link"] = $attributes->textContent;
|
$author["author-link"] = $attributes->textContent;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` IN ('%s', '%s') AND `network` != '%s'",
|
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `nurl` IN ('%s', '%s') AND `network` != '%s'",
|
||||||
intval($importer["uid"]), dbesc(normalise_link($author["author-link"])),
|
intval($importer["uid"]), dbesc(normalise_link($author["author-link"])),
|
||||||
dbesc(normalise_link($aliaslink)), dbesc(NETWORK_STATUSNET));
|
dbesc(normalise_link($aliaslink)), dbesc(NETWORK_STATUSNET));
|
||||||
if ($r) {
|
if (dbm::is_result($r)) {
|
||||||
$contact = $r[0];
|
$contact = $r[0];
|
||||||
$author["contact-id"] = $r[0]["id"];
|
$author["contact-id"] = $r[0]["id"];
|
||||||
} else
|
} else {
|
||||||
$author["contact-id"] = $contact["id"];
|
$author["contact-id"] = $contact["id"];
|
||||||
|
}
|
||||||
|
|
||||||
$avatarlist = array();
|
$avatarlist = array();
|
||||||
$avatars = $xpath->query("atom:author/atom:link[@rel='avatar']", $context);
|
$avatars = $xpath->query("atom:author/atom:link[@rel='avatar']", $context);
|
||||||
|
@ -103,22 +107,26 @@ class ostatus {
|
||||||
$href = "";
|
$href = "";
|
||||||
$width = 0;
|
$width = 0;
|
||||||
foreach ($avatar->attributes AS $attributes) {
|
foreach ($avatar->attributes AS $attributes) {
|
||||||
if ($attributes->name == "href")
|
if ($attributes->name == "href") {
|
||||||
$href = $attributes->textContent;
|
$href = $attributes->textContent;
|
||||||
if ($attributes->name == "width")
|
}
|
||||||
|
if ($attributes->name == "width") {
|
||||||
$width = $attributes->textContent;
|
$width = $attributes->textContent;
|
||||||
}
|
}
|
||||||
if (($width > 0) AND ($href != ""))
|
}
|
||||||
|
if (($width > 0) AND ($href != "")) {
|
||||||
$avatarlist[$width] = $href;
|
$avatarlist[$width] = $href;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (count($avatarlist) > 0) {
|
if (count($avatarlist) > 0) {
|
||||||
krsort($avatarlist);
|
krsort($avatarlist);
|
||||||
$author["author-avatar"] = self::fix_avatar(current($avatarlist), $author["author-link"]);
|
$author["author-avatar"] = self::fix_avatar(current($avatarlist), $author["author-link"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$displayname = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
|
$displayname = $xpath->evaluate('atom:author/poco:displayName/text()', $context)->item(0)->nodeValue;
|
||||||
if ($displayname != "")
|
if ($displayname != "") {
|
||||||
$author["author-name"] = $displayname;
|
$author["author-name"] = $displayname;
|
||||||
|
}
|
||||||
|
|
||||||
$author["owner-name"] = $author["author-name"];
|
$author["owner-name"] = $author["author-name"];
|
||||||
$author["owner-link"] = $author["author-link"];
|
$author["owner-link"] = $author["author-link"];
|
||||||
|
@ -1137,6 +1145,7 @@ class ostatus {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// @TODO One statment is okay (until if () )
|
||||||
$arr = array();
|
$arr = array();
|
||||||
$arr["network"] = $details["network"];
|
$arr["network"] = $details["network"];
|
||||||
$arr["uri"] = $single_conv->id;
|
$arr["uri"] = $single_conv->id;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue