Replace and/AND and or/OR by && and ||

This commit is contained in:
Hypolite Petovan 2017-06-08 21:20:27 -04:00
parent 844de15593
commit 8fa3f2415a
23 changed files with 268 additions and 269 deletions

View File

@ -107,7 +107,7 @@ function appnet_connect(&$a) {
$clientId = get_config('appnet','clientid'); $clientId = get_config('appnet','clientid');
$clientSecret = get_config('appnet','clientsecret'); $clientSecret = get_config('appnet','clientsecret');
if (($clientId == "") OR ($clientSecret == "")) { if (($clientId == "") || ($clientSecret == "")) {
$clientId = get_pconfig(local_user(),'appnet','clientid'); $clientId = get_pconfig(local_user(),'appnet','clientid');
$clientSecret = get_pconfig(local_user(),'appnet','clientsecret'); $clientSecret = get_pconfig(local_user(),'appnet','clientsecret');
} }
@ -154,7 +154,7 @@ function appnet_settings(&$a,&$s) {
$app_clientId = get_config('appnet','clientid'); $app_clientId = get_config('appnet','clientid');
$app_clientSecret = get_config('appnet','clientsecret'); $app_clientSecret = get_config('appnet','clientsecret');
if (($app_clientId == "") OR ($app_clientSecret == "")) { if (($app_clientId == "") || ($app_clientSecret == "")) {
$app_clientId = get_pconfig(local_user(),'appnet','clientid'); $app_clientId = get_pconfig(local_user(),'appnet','clientid');
$app_clientSecret = get_pconfig(local_user(),'appnet','clientsecret'); $app_clientSecret = get_pconfig(local_user(),'appnet','clientsecret');
} }
@ -213,7 +213,7 @@ function appnet_settings(&$a,&$s) {
$s .= t("<p>Error fetching user profile. Please clear the configuration and try again.</p>"); $s .= t("<p>Error fetching user profile. Please clear the configuration and try again.</p>");
} }
} elseif (($app_clientId == '') OR ($app_clientSecret == '')) { } elseif (($app_clientId == '') || ($app_clientSecret == '')) {
$s .= t("<p>You have two ways to connect to App.net.</p>"); $s .= t("<p>You have two ways to connect to App.net.</p>");
$s .= "<hr />"; $s .= "<hr />";
$s .= t('<p>First way: Register an application at <a href="https://account.app.net/developer/apps/">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. '); $s .= t('<p>First way: Register an application at <a href="https://account.app.net/developer/apps/">https://account.app.net/developer/apps/</a> and enter Client ID and Client Secret. ');
@ -245,7 +245,7 @@ function appnet_settings(&$a,&$s) {
$s .= '<a href="'.$url.'">'.t("Sign in using App.net").'</a>'; $s .= '<a href="'.$url.'">'.t("Sign in using App.net").'</a>';
} }
if (($app_clientId != '') OR ($app_clientSecret != '') OR ($token !='')) { if (($app_clientId != '') || ($app_clientSecret != '') || ($token !='')) {
$s .= '<div id="appnet-disconnect-wrapper">'; $s .= '<div id="appnet-disconnect-wrapper">';
$s .= '<label id="appnet-disconnect-label" for="appnet-disconnect">'. t('Clear OAuth configuration') .'</label>'; $s .= '<label id="appnet-disconnect-label" for="appnet-disconnect">'. t('Clear OAuth configuration') .'</label>';
@ -278,7 +278,7 @@ function appnet_settings_post(&$a,&$b) {
if (isset($_POST["clientid"])) if (isset($_POST["clientid"]))
set_pconfig(local_user(),'appnet','clientid', $_POST['clientid']); set_pconfig(local_user(),'appnet','clientid', $_POST['clientid']);
if (isset($_POST["token"]) AND ($_POST["token"] != "")) if (isset($_POST["token"]) && ($_POST["token"] != ""))
set_pconfig(local_user(),'appnet','token', $_POST['token']); set_pconfig(local_user(),'appnet','token', $_POST['token']);
set_pconfig(local_user(), 'appnet', 'post', intval($_POST['appnet'])); set_pconfig(local_user(), 'appnet', 'post', intval($_POST['appnet']));
@ -375,12 +375,12 @@ function appnet_create_entities($a, $b, $postdata) {
$start = $pos + 1; $start = $pos + 1;
} }
if (isset($postdata["url"]) AND isset($postdata["title"]) AND ($postdata["type"] != "photo")) { if (isset($postdata["url"]) && isset($postdata["title"]) && ($postdata["type"] != "photo")) {
$postdata["title"] = shortenmsg($postdata["title"], 90); $postdata["title"] = shortenmsg($postdata["title"], 90);
$max = 256 - strlen($postdata["title"]); $max = 256 - strlen($postdata["title"]);
$text = shortenmsg($text, $max); $text = shortenmsg($text, $max);
$text .= "\n[".$postdata["title"]."](".$postdata["url"].")"; $text .= "\n[".$postdata["title"]."](".$postdata["url"].")";
} elseif (isset($postdata["url"]) AND ($postdata["type"] != "photo")) { } elseif (isset($postdata["url"]) && ($postdata["type"] != "photo")) {
$postdata["url"] = short_link($postdata["url"]); $postdata["url"] = short_link($postdata["url"]);
$max = 240; $max = 240;
$text = shortenmsg($text, $max); $text = shortenmsg($text, $max);
@ -421,7 +421,7 @@ function appnet_send(&$a,&$b) {
logger("appnet_send: parameter ".print_r($b, true), LOGGER_DATA); logger("appnet_send: parameter ".print_r($b, true), LOGGER_DATA);
// Looking if its a reply to an app.net post // Looking if its a reply to an app.net post
if ((substr($b["parent-uri"], 0, 5) != "adn::") AND (substr($b["extid"], 0, 5) != "adn::") AND (substr($b["thr-parent"], 0, 5) != "adn::")) { if ((substr($b["parent-uri"], 0, 5) != "adn::") && (substr($b["extid"], 0, 5) != "adn::") && (substr($b["thr-parent"], 0, 5) != "adn::")) {
logger("appnet_send: no app.net post ".$b["parent"]); logger("appnet_send: no app.net post ".$b["parent"]);
return; return;
} }
@ -443,18 +443,18 @@ function appnet_send(&$a,&$b) {
$nicknameplain = "@".$nicknameplain; $nicknameplain = "@".$nicknameplain;
logger("appnet_send: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG); logger("appnet_send: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG);
if ((strpos($b["body"], $nickname) === false) AND (strpos($b["body"], $nicknameplain) === false)) if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false))
$b["body"] = $nickname." ".$b["body"]; $b["body"] = $nickname." ".$b["body"];
logger("appnet_send: parent found ".print_r($orig_post, true), LOGGER_DATA); logger("appnet_send: parent found ".print_r($orig_post, true), LOGGER_DATA);
} else { } else {
$iscomment = false; $iscomment = false;
if($b['private'] OR !strstr($b['postopts'],'appnet')) if($b['private'] || !strstr($b['postopts'],'appnet'))
return; return;
} }
if (($b['verb'] == ACTIVITY_POST) AND $b['deleted']) if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
appnet_action($a, $b["uid"], substr($orig_post["uri"], 5), "delete"); appnet_action($a, $b["uid"], substr($orig_post["uri"], 5), "delete");
if($b['verb'] == ACTIVITY_LIKE) { if($b['verb'] == ACTIVITY_LIKE) {
@ -542,7 +542,7 @@ function appnet_send(&$a,&$b) {
"value" => $attached_data "value" => $attached_data
); );
if (isset($post["url"]) AND !isset($post["title"]) AND ($post["type"] != "photo")) { if (isset($post["url"]) && !isset($post["title"]) && ($post["type"] != "photo")) {
$display_url = str_replace(array("http://www.", "https://www."), array("", ""), $post["url"]); $display_url = str_replace(array("http://www.", "https://www."), array("", ""), $post["url"]);
$display_url = str_replace(array("http://", "https://"), array("", ""), $display_url); $display_url = str_replace(array("http://", "https://"), array("", ""), $display_url);
@ -725,7 +725,7 @@ function appnet_fetchstream($a, $uid) {
$lastid = $post["id"]; $lastid = $post["id"];
if (($item != 0) AND ($postarray['contact-id'] != $me["id"]) AND !function_exists("check_item_notification")) { if (($item != 0) && ($postarray['contact-id'] != $me["id"]) && !function_exists("check_item_notification")) {
$r = q("SELECT `thread`.`iid` AS `parent` FROM `thread` $r = q("SELECT `thread`.`iid` AS `parent` FROM `thread`
INNER JOIN `item` ON `thread`.`iid` = `item`.`parent` AND `thread`.`uid` = `item`.`uid` INNER JOIN `item` ON `thread`.`iid` = `item`.`parent` AND `thread`.`uid` = `item`.`uid`
WHERE `item`.`id` = %d AND `thread`.`mention` LIMIT 1", dbesc($item)); WHERE `item`.`id` = %d AND `thread`.`mention` LIMIT 1", dbesc($item));
@ -788,7 +788,7 @@ function appnet_fetchstream($a, $uid) {
$parent_id = 0; $parent_id = 0;
logger('appnet_fetchstream: User '.$uid.' posted mention item '.$item); logger('appnet_fetchstream: User '.$uid.' posted mention item '.$item);
if ($item AND function_exists("check_item_notification")) if ($item && function_exists("check_item_notification"))
check_item_notification($item, $uid, NOTIFY_TAGSELF); check_item_notification($item, $uid, NOTIFY_TAGSELF);
} else { } else {
@ -797,7 +797,7 @@ function appnet_fetchstream($a, $uid) {
} }
// Fetch the parent and id // Fetch the parent and id
if (($parent_id == 0) AND ($postarray['uri'] != "")) { if (($parent_id == 0) && ($postarray['uri'] != "")) {
$r = q("SELECT `id`, `parent` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1", $r = q("SELECT `id`, `parent` FROM `item` WHERE `uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($postarray['uri']), dbesc($postarray['uri']),
intval($uid) intval($uid)
@ -811,8 +811,8 @@ function appnet_fetchstream($a, $uid) {
$lastid = $post["id"]; $lastid = $post["id"];
//if (($item != 0) AND ($postarray['contact-id'] != $me["id"])) { //if (($item != 0) && ($postarray['contact-id'] != $me["id"])) {
if (($item != 0) AND !function_exists("check_item_notification")) { if (($item != 0) && !function_exists("check_item_notification")) {
require_once('include/enotify.php'); require_once('include/enotify.php');
notification(array( notification(array(
'type' => NOTIFY_TAGSELF, 'type' => NOTIFY_TAGSELF,
@ -886,7 +886,7 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
return($r[0]); return($r[0]);
} }
if (isset($post["reply_to"]) AND ($post["reply_to"] != "")) { if (isset($post["reply_to"]) && ($post["reply_to"] != "")) {
$postarray['thr-parent'] = "adn::".$post["reply_to"]; $postarray['thr-parent'] = "adn::".$post["reply_to"];
// Complete the thread (if the parent doesn't exists) // Complete the thread (if the parent doesn't exists)
@ -937,7 +937,7 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
$postarray['object-type'] = ACTIVITY_OBJ_NOTE; $postarray['object-type'] = ACTIVITY_OBJ_NOTE;
} }
if (($post["user"]["id"] != $ownid) OR ($postarray['thr-parent'] == $postarray['uri'])) { if (($post["user"]["id"] != $ownid) || ($postarray['thr-parent'] == $postarray['uri'])) {
$postarray['owner-name'] = $post["user"]["name"]; $postarray['owner-name'] = $post["user"]["name"];
$postarray['owner-link'] = $post["user"]["canonical_url"]; $postarray['owner-link'] = $post["user"]["canonical_url"];
$postarray['owner-avatar'] = $post["user"]["avatar_image"]["url"]; $postarray['owner-avatar'] = $post["user"]["avatar_image"]["url"];
@ -1015,7 +1015,7 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
if (is_array($content["annotations"])) { if (is_array($content["annotations"])) {
$photo = appnet_expand_annotations($a, $content["annotations"]); $photo = appnet_expand_annotations($a, $content["annotations"]);
if (($photo["large"] != "") AND ($photo["url"] != "")) if (($photo["large"] != "") && ($photo["url"] != ""))
$page_info = "\n[url=".$photo["url"]."][img]".$photo["large"]."[/img][/url]"; $page_info = "\n[url=".$photo["url"]."][img]".$photo["large"]."[/img][/url]";
elseif ($photo["url"] != "") elseif ($photo["url"] != "")
$page_info = "\n[img]".$photo["url"]."[/img]"; $page_info = "\n[img]".$photo["url"]."[/img]";
@ -1034,7 +1034,7 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th
if (trim($page_info) != "") { if (trim($page_info) != "") {
$removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $postarray['body']); $removedlink = preg_replace("/\[url\=".$url."\](.*?)\[\/url\]/ism", '', $postarray['body']);
if (($removedlink == "") OR strstr($postarray['body'], $removedlink)) if (($removedlink == "") || strstr($postarray['body'], $removedlink))
$postarray['body'] = $removedlink; $postarray['body'] = $removedlink;
} }
} }
@ -1075,7 +1075,7 @@ function appnet_expand_entities($a, $body, $entities) {
foreach ($entities["links"] AS $links) { foreach ($entities["links"] AS $links) {
$url = "[url=".$links["url"]."]".$links["text"]."[/url]"; $url = "[url=".$links["url"]."]".$links["text"]."[/url]";
if (isset($links["amended_len"]) AND ($links["amended_len"] > $links["len"])) if (isset($links["amended_len"]) && ($links["amended_len"] > $links["len"]))
$replace[$links["pos"]] = array("pos"=> $links["pos"], "len"=> $links["amended_len"], "replace"=> $url); $replace[$links["pos"]] = array("pos"=> $links["pos"], "len"=> $links["amended_len"], "replace"=> $url);
else else
$replace[$links["pos"]] = array("pos"=> $links["pos"], "len"=> $links["len"], "replace"=> $url); $replace[$links["pos"]] = array("pos"=> $links["pos"], "len"=> $links["len"], "replace"=> $url);
@ -1100,7 +1100,7 @@ function appnet_expand_entities($a, $body, $entities) {
function appnet_expand_annotations($a, $annotations) { function appnet_expand_annotations($a, $annotations) {
$photo = array("url" => "", "large" => ""); $photo = array("url" => "", "large" => "");
foreach ($annotations AS $annotation) { foreach ($annotations AS $annotation) {
if (($annotation[type] == "net.app.core.oembed") AND if (($annotation[type] == "net.app.core.oembed") &&
($annotation["value"]["type"] == "photo")) { ($annotation["value"]["type"] == "photo")) {
if ($annotation["value"]["url"] != "") if ($annotation["value"]["url"] != "")
$photo["url"] = $annotation["value"]["url"]; $photo["url"] = $annotation["value"]["url"];
@ -1108,7 +1108,7 @@ function appnet_expand_annotations($a, $annotations) {
if ($annotation["value"]["thumbnail_large_url"] != "") if ($annotation["value"]["thumbnail_large_url"] != "")
$photo["large"] = $annotation["value"]["thumbnail_large_url"]; $photo["large"] = $annotation["value"]["thumbnail_large_url"];
//if (($annotation["value"]["thumbnail_large_url"] != "") AND ($annotation["value"]["url"] != "")) //if (($annotation["value"]["thumbnail_large_url"] != "") && ($annotation["value"]["url"] != ""))
// $embedded = "\n[url=".$annotation["value"]["url"]."][img]".$annotation["value"]["thumbnail_large_url"]."[/img][/url]"; // $embedded = "\n[url=".$annotation["value"]["url"]."][img]".$annotation["value"]["thumbnail_large_url"]."[/img][/url]";
//elseif ($annotation["value"]["url"] != "") //elseif ($annotation["value"]["url"] != "")
// $embedded = "\n[img]".$annotation["value"]["url"]."[/img]"; // $embedded = "\n[img]".$annotation["value"]["url"]."[/img]";
@ -1128,13 +1128,13 @@ function appnet_fetchcontact($a, $uid, $contact, $me, $create_user) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("adn::".$contact["id"])); intval($uid), dbesc("adn::".$contact["id"]));
if(!count($r) AND !$create_user) if(!count($r) && !$create_user)
return($me["id"]); return($me["id"]);
if ($contact["canonical_url"] == "") if ($contact["canonical_url"] == "")
return($me["id"]); return($me["id"]);
if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) { if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); logger("appnet_fetchcontact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return(-1); return(-1);
} }
@ -1278,7 +1278,7 @@ function appnet_prepare_body(&$a,&$b) {
$nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]"; $nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]";
$nicknameplain = "@".$nicknameplain; $nicknameplain = "@".$nicknameplain;
if ((strpos($item["body"], $nickname) === false) AND (strpos($item["body"], $nicknameplain) === false)) if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false))
$item["body"] = $nickname." ".$item["body"]; $item["body"] = $nickname." ".$item["body"];
} }

View File

@ -339,14 +339,14 @@ function buffer_send(&$a,&$b) {
// Seems like a bug to me // Seems like a bug to me
// Buffer doesn't add links to Twitter and App.net (but pictures) // Buffer doesn't add links to Twitter and App.net (but pictures)
//if ($includedlinks AND isset($post["url"])) //if ($includedlinks && isset($post["url"]))
if (($profile->service == "twitter") AND isset($post["url"]) AND ($post["type"] != "photo")) if (($profile->service == "twitter") && isset($post["url"]) && ($post["type"] != "photo"))
$post["text"] .= " ".$post["url"]; $post["text"] .= " ".$post["url"];
elseif (($profile->service == "appdotnet") AND isset($post["url"]) AND isset($post["title"]) AND ($post["type"] != "photo")) { elseif (($profile->service == "appdotnet") && isset($post["url"]) && isset($post["title"]) && ($post["type"] != "photo")) {
$post["title"] = shortenmsg($post["title"], 90); $post["title"] = shortenmsg($post["title"], 90);
$post["text"] = shortenmsg($post["text"], $limit - (24 + strlen($post["title"]))); $post["text"] = shortenmsg($post["text"], $limit - (24 + strlen($post["title"])));
$post["text"] .= "\n[".$post["title"]."](".$post["url"].")"; $post["text"] .= "\n[".$post["title"]."](".$post["url"].")";
} elseif (($profile->service == "appdotnet") AND isset($post["url"]) AND ($post["type"] != "photo")) } elseif (($profile->service == "appdotnet") && isset($post["url"]) && ($post["type"] != "photo"))
$post["text"] .= " ".$post["url"]; $post["text"] .= " ".$post["url"];
elseif ($profile->service == "google") elseif ($profile->service == "google")
$post["text"] .= html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8'); // Send a special blank to identify the post through the "fromgplus" addon $post["text"] .= html_entity_decode("&#x00A0;", ENT_QUOTES, 'UTF-8'); // Send a special blank to identify the post through the "fromgplus" addon
@ -363,7 +363,7 @@ function buffer_send(&$a,&$b) {
if (isset($post["description"])) if (isset($post["description"]))
$message["media[description]"] = $post["description"]; $message["media[description]"] = $post["description"];
if (isset($post["url"]) AND ($post["type"] != "photo")) if (isset($post["url"]) && ($post["type"] != "photo"))
$message["media[link]"] = $post["url"]; $message["media[link]"] = $post["url"];
if (isset($post["image"])) { if (isset($post["image"])) {

View File

@ -85,7 +85,7 @@
if ($callback_url) $this->set_callback_url($callback_url); if ($callback_url) $this->set_callback_url($callback_url);
if ($access_token) $this->access_token = $access_token; if ($access_token) $this->access_token = $access_token;
if (isset($_GET['code']) AND $_GET['code']) { if (isset($_GET['code']) && $_GET['code']) {
$this->code = $_GET['code']; $this->code = $_GET['code'];
$this->create_access_token_url(); $this->create_access_token_url();
} }

View File

@ -142,7 +142,7 @@ function diaspora_settings(&$a,&$s) {
$aspects = false; $aspects = false;
if ($handle AND $password) { if ($handle && $password) {
$conn = new Diaspora_Connection($handle, $password); $conn = new Diaspora_Connection($handle, $password);
$conn->logIn(); $conn->logIn();
$aspects = $conn->getAspects(); $aspects = $conn->getAspects();

View File

@ -260,7 +260,7 @@ function fb_get_friends_sync_parsecontact($uid, $contact) {
$contact->link = 'http://facebook.com/profile.php?id=' . $contact->id; $contact->link = 'http://facebook.com/profile.php?id=' . $contact->id;
// If its a page then set the first name from the username // If its a page then set the first name from the username
if (!$contact->first_name and $contact->username) if (!$contact->first_name && $contact->username)
$contact->first_name = $contact->username; $contact->first_name = $contact->username;
// check if we already have a contact // check if we already have a contact
@ -1145,7 +1145,7 @@ function facebook_post_hook(&$a,&$b) {
if($reply) { if($reply) {
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments'); $url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
} else if (($link != "") or ($image != "") or ($b['title'] == '') or (strlen($msg) < 500)) { } else if (($link != "") || ($image != "") || ($b['title'] == '') || (strlen($msg) < 500)) {
$url = 'https://graph.facebook.com/me/feed'; $url = 'https://graph.facebook.com/me/feed';
if($b['plink']) if($b['plink'])
$postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}'; $postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}';
@ -1760,19 +1760,19 @@ function fb_consume_stream($uid,$j,$wall = false) {
$datarray['body'] = (isset($entry->message) ? escape_tags($entry->message) : ''); $datarray['body'] = (isset($entry->message) ? escape_tags($entry->message) : '');
if(isset($entry->name) and isset($entry->link)) if(isset($entry->name) && isset($entry->link))
$datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->name."[/bookmark]"; $datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->name."[/bookmark]";
elseif (isset($entry->name)) elseif (isset($entry->name))
$datarray['body'] .= "\n\n[b]" . $entry->name."[/b]"; $datarray['body'] .= "\n\n[b]" . $entry->name."[/b]";
if(isset($entry->caption)) { if(isset($entry->caption)) {
if(!isset($entry->name) and isset($entry->link)) if(!isset($entry->name) && isset($entry->link))
$datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->caption."[/bookmark]"; $datarray['body'] .= "\n\n[bookmark=".$entry->link."]".$entry->caption."[/bookmark]";
else else
$datarray['body'] .= "[i]" . $entry->caption."[/i]\n"; $datarray['body'] .= "[i]" . $entry->caption."[/i]\n";
} }
if(!isset($entry->caption) and !isset($entry->name)) { if(!isset($entry->caption) && !isset($entry->name)) {
if (isset($entry->link)) if (isset($entry->link))
$datarray['body'] .= "\n[url]".$entry->link."[/url]\n"; $datarray['body'] .= "\n[url]".$entry->link."[/url]\n";
else else
@ -1805,7 +1805,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
} }
} }
if (($datarray['app'] == "Events") and isset($entry->actions)) if (($datarray['app'] == "Events") && isset($entry->actions))
foreach ($entry->actions as $action) foreach ($entry->actions as $action)
if ($action->name == "View") if ($action->name == "View")
$datarray['body'] .= " [url=".$action->link."]".$entry->story."[/url]"; $datarray['body'] .= " [url=".$action->link."]".$entry->story."[/url]";
@ -1815,7 +1815,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
// $datarray['body'] = $entry->story; // $datarray['body'] = $entry->story;
// Adding the "story" text to see if there are useful data in it (testing) // Adding the "story" text to see if there are useful data in it (testing)
//if (($datarray['app'] != "Events") and $entry->story) //if (($datarray['app'] != "Events") && $entry->story)
// $datarray['body'] .= "\n".$entry->story; // $datarray['body'] .= "\n".$entry->story;
if(trim($datarray['body']) == '') { if(trim($datarray['body']) == '') {
@ -1830,17 +1830,17 @@ function fb_consume_stream($uid,$j,$wall = false) {
if (isset($entry->actions)) if (isset($entry->actions))
foreach ($entry->actions as $action) foreach ($entry->actions as $action)
if (($action->name != "Comment") and ($action->name != "Like")) if (($action->name != "Comment") && ($action->name != "Like"))
$datarray['body'] .= "[url=".$action->link."]".$action->name."[/url] &nbsp; "; $datarray['body'] .= "[url=".$action->link."]".$action->name."[/url] &nbsp; ";
$datarray['body'] = trim($datarray['body']); $datarray['body'] = trim($datarray['body']);
//if(($datarray['body'] != '') and ($uid == 1)) //if(($datarray['body'] != '') && ($uid == 1))
// $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]"; // $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]";
if (isset($entry->place)) { if (isset($entry->place)) {
if ($entry->place->name or $entry->place->location->street or if ($entry->place->name || $entry->place->location->street ||
$entry->place->location->city or $entry->place->location->Denmark) { $entry->place->location->city || $entry->place->location->Denmark) {
$datarray['coord'] = ''; $datarray['coord'] = '';
if ($entry->place->name) if ($entry->place->name)
$datarray['coord'] .= $entry->place->name; $datarray['coord'] .= $entry->place->name;
@ -1850,7 +1850,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
$datarray['coord'] .= " ".$entry->place->location->city; $datarray['coord'] .= " ".$entry->place->location->city;
if ($entry->place->location->country) if ($entry->place->location->country)
$datarray['coord'] .= " ".$entry->place->location->country; $datarray['coord'] .= " ".$entry->place->location->country;
} else if ($entry->place->location->latitude and $entry->place->location->longitude) } else if ($entry->place->location->latitude && $entry->place->location->longitude)
$datarray['coord'] = substr($entry->place->location->latitude, 0, 8) $datarray['coord'] = substr($entry->place->location->latitude, 0, 8)
.' '.substr($entry->place->location->longitude, 0, 8); .' '.substr($entry->place->location->longitude, 0, 8);
} }

View File

@ -435,7 +435,7 @@ function fbpost_post_hook(&$a,&$b) {
if($b['extid'] == NETWORK_FACEBOOK) if($b['extid'] == NETWORK_FACEBOOK)
return; return;
if(($b['app'] == "Facebook") AND ($b['verb'] != ACTIVITY_LIKE)) if(($b['app'] == "Facebook") && ($b['verb'] != ACTIVITY_LIKE))
return; return;
logger('fbpost_post_hook: Facebook post accepted', LOGGER_DEBUG); logger('fbpost_post_hook: Facebook post accepted', LOGGER_DEBUG);
@ -473,7 +473,7 @@ function fbpost_post_hook(&$a,&$b) {
// A reply to a toplevel post is only allowed for "real" facebook posts // A reply to a toplevel post is only allowed for "real" facebook posts
if(count($r) && substr($r[0]['uri'],0,4) === 'fb::') if(count($r) && substr($r[0]['uri'],0,4) === 'fb::')
$reply = substr($r[0]['uri'],4); $reply = substr($r[0]['uri'],4);
elseif(count($r) && (substr($r[0]['extid'],0,4) === 'fb::') AND ($r[0]['id'] != $r[0]['parent'])) elseif(count($r) && (substr($r[0]['extid'],0,4) === 'fb::') && ($r[0]['id'] != $r[0]['parent']))
$reply = substr($r[0]['extid'],4); $reply = substr($r[0]['extid'],4);
else else
return; return;
@ -647,14 +647,14 @@ function fbpost_post_hook(&$a,&$b) {
$post_to_page = get_pconfig($b['uid'],'facebook','post_to_page'); $post_to_page = get_pconfig($b['uid'],'facebook','post_to_page');
$page_access_token = get_pconfig($b['uid'],'facebook','page_access_token'); $page_access_token = get_pconfig($b['uid'],'facebook','page_access_token');
if ((intval($post_to_page) != 0) and ($page_access_token != "")) if ((intval($post_to_page) != 0) && ($page_access_token != ""))
$target = $post_to_page; $target = $post_to_page;
else else
$target = "me"; $target = "me";
if($reply) { if($reply) {
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments'); $url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
} else if (($video != "") or (($image == "") and ($link != ""))) { } else if (($video != "") || (($image == "") && ($link != ""))) {
// If it is a link to a video or a link without a preview picture then post it as a link // If it is a link to a video or a link without a preview picture then post it as a link
if ($video != "") if ($video != "")
$link = $video; $link = $video;
@ -667,7 +667,7 @@ function fbpost_post_hook(&$a,&$b) {
$postvars['message'] = $msg; $postvars['message'] = $msg;
$url = 'https://graph.facebook.com/'.$target.'/links'; $url = 'https://graph.facebook.com/'.$target.'/links';
} else if (($link == "") and ($image != "")) { } else if (($link == "") && ($image != "")) {
// If it is only an image without a page link then post this image as a photo // If it is only an image without a page link then post this image as a photo
$postvars = array( $postvars = array(
'access_token' => $fb_token, 'access_token' => $fb_token,
@ -677,10 +677,10 @@ function fbpost_post_hook(&$a,&$b) {
$postvars['message'] = $msg; $postvars['message'] = $msg;
$url = 'https://graph.facebook.com/'.$target.'/photos'; $url = 'https://graph.facebook.com/'.$target.'/photos';
//} else if (($link != "") or ($image != "") or ($b['title'] == '') or (strlen($msg) < 500)) { //} else if (($link != "") || ($image != "") || ($b['title'] == '') || (strlen($msg) < 500)) {
} else { } else {
$url = 'https://graph.facebook.com/'.$target.'/feed'; $url = 'https://graph.facebook.com/'.$target.'/feed';
if (!get_pconfig($b['uid'],'facebook','suppress_view_on_friendica') and $b['plink']) if (!get_pconfig($b['uid'],'facebook','suppress_view_on_friendica') && $b['plink'])
$postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}'; $postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}';
} }
/* } else { /* } else {
@ -694,7 +694,7 @@ function fbpost_post_hook(&$a,&$b) {
} */ } */
// Post to page? // Post to page?
if (!$reply and ($target != "me") and $page_access_token) if (!$reply && ($target != "me") && $page_access_token)
$postvars['access_token'] = $page_access_token; $postvars['access_token'] = $page_access_token;
logger('fbpost_post_hook: post to ' . $url); logger('fbpost_post_hook: post to ' . $url);
@ -721,7 +721,7 @@ function fbpost_post_hook(&$a,&$b) {
// If it is a special kind of failure the post was receiced // If it is a special kind of failure the post was receiced
// Although facebook said it wasn't received ... // Although facebook said it wasn't received ...
if (!$likes AND (($retj->error->type != "OAuthException") OR ($retj->error->code != 2)) AND ($x <> "")) { if (!$likes && (($retj->error->type != "OAuthException") || ($retj->error->code != 2)) && ($x <> "")) {
$r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid'])); $r = q("SELECT `id` FROM `contact` WHERE `uid` = %d AND `self`", intval($b['uid']));
if (count($r)) if (count($r))
$a->contact = $r[0]["id"]; $a->contact = $r[0]["id"];
@ -873,7 +873,7 @@ function fbpost_queue_hook(&$a,&$b) {
// If it is a special kind of failure the post was receiced // If it is a special kind of failure the post was receiced
// Although facebook said it wasn't received ... // Although facebook said it wasn't received ...
$ret = json_decode($j); $ret = json_decode($j);
if (($ret->error->type != "OAuthException") OR ($ret->error->code != 2) AND ($j <> "")) if (($ret->error->type != "OAuthException") || ($ret->error->code != 2) && ($j <> ""))
update_queue_time($x['id']); update_queue_time($x['id']);
else else
logger('fbpost_queue_hook: Not requeued, since it seems to be received'); logger('fbpost_queue_hook: Not requeued, since it seems to be received');
@ -980,7 +980,7 @@ function fbpost_cleanpicture($url) {
$urldata = parse_url($url); $urldata = parse_url($url);
if (isset($urldata["query"])) { if (isset($urldata["query"])) {
parse_str($urldata["query"], $querydata); parse_str($urldata["query"], $querydata);
if (isset($querydata["url"]) AND (get_photo_info($querydata["url"]))) if (isset($querydata["url"]) && (get_photo_info($querydata["url"])))
return($querydata["url"]); return($querydata["url"]);
} }
return($url); return($url);
@ -1036,10 +1036,10 @@ function fbpost_fetchwall($a, $uid) {
elseif(!isset($item->privacy)) elseif(!isset($item->privacy))
continue; continue;
if (($post_to_page != $item->from->id) AND ((int)$post_to_page != 0)) if (($post_to_page != $item->from->id) && ((int)$post_to_page != 0))
continue; continue;
if (!strstr($item->id, $item->from->id."_") AND isset($item->to) AND ((int)$post_to_page == 0)) if (!strstr($item->id, $item->from->id."_") && isset($item->to) && ((int)$post_to_page == 0))
continue; continue;
$_SESSION["authenticated"] = true; $_SESSION["authenticated"] = true;
@ -1061,7 +1061,7 @@ function fbpost_fetchwall($a, $uid) {
$content = ""; $content = "";
$pagedata["type"] = ""; $pagedata["type"] = "";
if(isset($item->name) and isset($item->link)) { if(isset($item->name) && isset($item->link)) {
$item->link = original_url($item->link); $item->link = original_url($item->link);
$oembed_data = oembed_fetch_url($item->link); $oembed_data = oembed_fetch_url($item->link);
$pagedata["type"] = $oembed_data->type; $pagedata["type"] = $oembed_data->type;
@ -1072,31 +1072,31 @@ function fbpost_fetchwall($a, $uid) {
// If a link is not only attached but also added in the body, look if it can be removed in the body. // If a link is not only attached but also added in the body, look if it can be removed in the body.
$removedlink = trim(str_replace($item->link, "", $_REQUEST["body"])); $removedlink = trim(str_replace($item->link, "", $_REQUEST["body"]));
if (($removedlink == "") OR strstr($_REQUEST["body"], $removedlink)) if (($removedlink == "") || strstr($_REQUEST["body"], $removedlink))
$_REQUEST["body"] = $removedlink; $_REQUEST["body"] = $removedlink;
} elseif (isset($item->name)) } elseif (isset($item->name))
$content .= "[b]".$item->name."[/b]"; $content .= "[b]".$item->name."[/b]";
$pagedata["text"] = ""; $pagedata["text"] = "";
if(isset($item->description) and ($item->type != "photo")) if(isset($item->description) && ($item->type != "photo"))
$pagedata["text"] = $item->description; $pagedata["text"] = $item->description;
if(isset($item->caption) and ($item->type == "photo")) if(isset($item->caption) && ($item->type == "photo"))
$pagedata["text"] = $item->caption; $pagedata["text"] = $item->caption;
// Only import the picture when the message is no video // Only import the picture when the message is no video
// oembed display a picture of the video as well // oembed display a picture of the video as well
//if ($item->type != "video") { //if ($item->type != "video") {
//if (($item->type != "video") and ($item->type != "photo")) { //if (($item->type != "video") && ($item->type != "photo")) {
if (($pagedata["type"] == "") OR ($pagedata["type"] == "link")) { if (($pagedata["type"] == "") || ($pagedata["type"] == "link")) {
$pagedata["type"] = $item->type; $pagedata["type"] = $item->type;
if (isset($item->picture)) if (isset($item->picture))
$pagedata["images"][0]["src"] = $item->picture; $pagedata["images"][0]["src"] = $item->picture;
if (($pagedata["type"] == "photo") AND isset($item->object_id)) { if (($pagedata["type"] == "photo") && isset($item->object_id)) {
logger('fbpost_fetchwall: fetching fbid '.$item->object_id, LOGGER_DEBUG); logger('fbpost_fetchwall: fetching fbid '.$item->object_id, LOGGER_DEBUG);
$url = "https://graph.facebook.com/".$item->object_id."?access_token=".$access_token; $url = "https://graph.facebook.com/".$item->object_id."?access_token=".$access_token;
$feed = fetch_url($url); $feed = fetch_url($url);
@ -1151,8 +1151,8 @@ function fbpost_fetchwall($a, $uid) {
} }
if (isset($item->place)) { if (isset($item->place)) {
if ($item->place->name or $item->place->location->street or if ($item->place->name || $item->place->location->street ||
$item->place->location->city or $item->place->location->country) { $item->place->location->city || $item->place->location->country) {
$_REQUEST["location"] = ''; $_REQUEST["location"] = '';
if ($item->place->name) if ($item->place->name)
$_REQUEST["location"] .= $item->place->name; $_REQUEST["location"] .= $item->place->name;
@ -1165,7 +1165,7 @@ function fbpost_fetchwall($a, $uid) {
$_REQUEST["location"] = trim($_REQUEST["location"]); $_REQUEST["location"] = trim($_REQUEST["location"]);
} }
if ($item->place->location->latitude and $item->place->location->longitude) if ($item->place->location->latitude && $item->place->location->longitude)
$_REQUEST["coord"] = substr($item->place->location->latitude, 0, 8) $_REQUEST["coord"] = substr($item->place->location->latitude, 0, 8)
.' '.substr($item->place->location->longitude, 0, 8); .' '.substr($item->place->location->longitude, 0, 8);
} }
@ -1210,7 +1210,7 @@ function fbpost_get_photo($uid,$link) {
function fpost_cleanpicture($image) { function fpost_cleanpicture($image) {
if ((strpos($image, ".fbcdn.net/") OR strpos($image, "/fbcdn-photos-")) and (substr($image, -6) == "_s.jpg")) if ((strpos($image, ".fbcdn.net/") || strpos($image, "/fbcdn-photos-")) && (substr($image, -6) == "_s.jpg"))
$image = substr($image, 0, -6)."_n.jpg"; $image = substr($image, 0, -6)."_n.jpg";
$queryvar = fbpost_parse_query($image); $queryvar = fbpost_parse_query($image);

View File

@ -42,7 +42,7 @@ function fbsync_follow($a, &$contact) {
logger("fbsync_follow: Check if contact is facebook contact. ".$contact["url"], LOGGER_DEBUG); logger("fbsync_follow: Check if contact is facebook contact. ".$contact["url"], LOGGER_DEBUG);
if (!strstr($contact["url"], "://www.facebook.com") AND !strstr($contact["url"], "://facebook.com") AND !strstr($contact["url"], "@facebook.com")) if (!strstr($contact["url"], "://www.facebook.com") && !strstr($contact["url"], "://facebook.com") && !strstr($contact["url"], "@facebook.com"))
return; return;
// contact seems to be a facebook contact, so continue // contact seems to be a facebook contact, so continue
@ -267,7 +267,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
$contact_id = 0; $contact_id = 0;
if (($post->parent_post_id != "") AND ($post->actor_id == $post->source_id)) { if (($post->parent_post_id != "") && ($post->actor_id == $post->source_id)) {
$pos = strpos($post->parent_post_id, "_"); $pos = strpos($post->parent_post_id, "_");
if ($pos != 0) { if ($pos != 0) {
@ -279,7 +279,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
$postarray['contact-id'] = $contact_id; $postarray['contact-id'] = $contact_id;
if (array_key_exists("name", $userdata) AND ($userdata["name"] != "") AND !link_compare($userdata["link"], $postarray['author-link'])) { if (array_key_exists("name", $userdata) && ($userdata["name"] != "") && !link_compare($userdata["link"], $postarray['author-link'])) {
$postarray['owner-name'] = $userdata["name"]; $postarray['owner-name'] = $userdata["name"];
$postarray['owner-link'] = $userdata["link"]; $postarray['owner-link'] = $userdata["link"];
$postarray['owner-avatar'] = $userdata["avatar"]; $postarray['owner-avatar'] = $userdata["avatar"];
@ -303,7 +303,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
// Testing if we know the source or the actor // Testing if we know the source or the actor
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], false); $contact_id = fbsync_fetch_contact($uid, $contacts[$post->source_id], false);
if (($contact_id == 0) and array_key_exists($post->actor_id, $contacts)) if (($contact_id == 0) && array_key_exists($post->actor_id, $contacts))
$contact_id = fbsync_fetch_contact($uid, $contacts[$post->actor_id], false); $contact_id = fbsync_fetch_contact($uid, $contacts[$post->actor_id], false);
// If we don't know anyone, we guess we should know the source. Could be the wrong decision // If we don't know anyone, we guess we should know the source. Could be the wrong decision
@ -316,7 +316,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
if ($contact_id == -1) { if ($contact_id == -1) {
logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG); logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG);
return; return;
} elseif (($contact_id <= 0) AND !$create_user) { } elseif (($contact_id <= 0) && !$create_user) {
logger('fbsync_createpost: No matching contact found. Post not imported '.print_r($post, true), LOGGER_DEBUG); logger('fbsync_createpost: No matching contact found. Post not imported '.print_r($post, true), LOGGER_DEBUG);
return; return;
} elseif ($contact_id == 0) { } elseif ($contact_id == 0) {
@ -357,7 +357,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
$content = ""; $content = "";
$pagedata["type"] = ""; $pagedata["type"] = "";
if (isset($post->attachment->name) and isset($post->attachment->href)) { if (isset($post->attachment->name) && isset($post->attachment->href)) {
$post->attachment->href = original_url($post->attachment->href); $post->attachment->href = original_url($post->attachment->href);
$oembed_data = oembed_fetch_url($post->attachment->href); $oembed_data = oembed_fetch_url($post->attachment->href);
$pagedata["type"] = $oembed_data->type; $pagedata["type"] = $oembed_data->type;
@ -371,23 +371,23 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
// If a link is not only attached but also added in the body, look if it can be removed in the body. // If a link is not only attached but also added in the body, look if it can be removed in the body.
$removedlink = trim(str_replace($post->attachment->href, "", $postarray["body"])); $removedlink = trim(str_replace($post->attachment->href, "", $postarray["body"]));
if (($removedlink == "") OR strstr($postarray["body"], $removedlink)) if (($removedlink == "") || strstr($postarray["body"], $removedlink))
$postarray["body"] = $removedlink; $postarray["body"] = $removedlink;
} elseif (isset($post->attachment->name) AND ($post->attachment->name != "")) } elseif (isset($post->attachment->name) && ($post->attachment->name != ""))
$content = "[b]" . $post->attachment->name."[/b]"; $content = "[b]" . $post->attachment->name."[/b]";
$pagedata["text"] = ""; $pagedata["text"] = "";
if (isset($post->attachment->description) and ($post->attachment->fb_object_type != "photo")) if (isset($post->attachment->description) && ($post->attachment->fb_object_type != "photo"))
$pagedata["text"] = $post->attachment->description; $pagedata["text"] = $post->attachment->description;
if (isset($post->attachment->caption) and ($post->attachment->fb_object_type == "photo")) if (isset($post->attachment->caption) && ($post->attachment->fb_object_type == "photo"))
$pagedata["text"] = $post->attachment->caption; $pagedata["text"] = $post->attachment->caption;
if ($pagedata["text"].$post->attachment->href.$content.$postarray["body"] == "") if ($pagedata["text"].$post->attachment->href.$content.$postarray["body"] == "")
return; return;
if (isset($post->attachment->media) AND (($pagedata["type"] == "") OR ($pagedata["type"] == "link"))) { if (isset($post->attachment->media) && (($pagedata["type"] == "") || ($pagedata["type"] == "link"))) {
foreach ($post->attachment->media AS $media) { foreach ($post->attachment->media AS $media) {
if (isset($media->type)) if (isset($media->type))
@ -397,7 +397,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
$pagedata["images"][0]["src"] = $media->src; $pagedata["images"][0]["src"] = $media->src;
if (isset($media->photo)) { if (isset($media->photo)) {
if (isset($media->photo->images) AND (count($media->photo->images) > 1)) if (isset($media->photo->images) && (count($media->photo->images) > 1))
$pagedata["images"][0]["src"] = $media->photo->images[1]->src; $pagedata["images"][0]["src"] = $media->photo->images[1]->src;
if (isset($media->photo->fbid)) { if (isset($media->photo->fbid)) {
@ -415,7 +415,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
$pagedata["images"][0]["src"] = fbpost_cleanpicture($pagedata["images"][0]["src"]); $pagedata["images"][0]["src"] = fbpost_cleanpicture($pagedata["images"][0]["src"]);
if (isset($media->href) AND ($pagedata["images"][0]["src"] != "") AND ($media->href != "")) { if (isset($media->href) && ($pagedata["images"][0]["src"] != "") && ($media->href != "")) {
$media->href = original_url($media->href); $media->href = original_url($media->href);
$pagedata["url"] = $media->href; $pagedata["url"] = $media->href;
$content .= "\n".'[url='.$media->href.'][img]'.$pagedata["images"][0]["src"].'[/img][/url]'; $content .= "\n".'[url='.$media->href.'][img]'.$pagedata["images"][0]["src"].'[/img][/url]';
@ -538,7 +538,7 @@ function fbsync_createcomment($a, $uid, $self_id, $self, $user, $contacts, $appl
} }
// Is blocked? Then return // Is blocked? Then return
if ($r[0]["readonly"] OR $r[0]["blocked"]) { if ($r[0]["readonly"] || $r[0]["blocked"]) {
logger("fbsync_createcomment: UID ".$uid." - Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); logger("fbsync_createcomment: UID ".$uid." - Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return; return;
} }
@ -640,7 +640,7 @@ function fbsync_createcomment($a, $uid, $self_id, $self, $user, $contacts, $appl
foreach($myconv as $conv) { foreach($myconv as $conv) {
// now if we find a match, it means we're in this conversation // now if we find a match, it means we're in this conversation
if(!link_compare($conv['author-link'],$importer_url) AND !link_compare($conv['author-link'],$own_contact[0]["url"])) if(!link_compare($conv['author-link'],$importer_url) && !link_compare($conv['author-link'],$own_contact[0]["url"]))
continue; continue;
require_once('include/enotify.php'); require_once('include/enotify.php');
@ -785,10 +785,10 @@ function fbsync_fetch_contact($uid, $contact, $create_user) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("facebook::".$contact->id)); intval($uid), dbesc("facebook::".$contact->id));
if(!count($r) AND !$create_user) if(!count($r) && !$create_user)
return(0); return(0);
if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) { if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("fbsync_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); logger("fbsync_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return(-1); return(-1);
} }
@ -970,7 +970,7 @@ function fbsync_fetchuser($a, $uid, $id) {
intval($uid), dbesc("facebook::".$id)); intval($uid), dbesc("facebook::".$id));
if (count($contact)) { if (count($contact)) {
if (($contact[0]["readonly"] OR $contact[0]["blocked"])) { if (($contact[0]["readonly"] || $contact[0]["blocked"])) {
logger("fbsync_fetchuser: Contact '".$contact[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); logger("fbsync_fetchuser: Contact '".$contact[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
$user["contact-id"] = -1; $user["contact-id"] = -1;
} else } else

View File

@ -178,7 +178,7 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) {
$_REQUEST['location'] = $location; $_REQUEST['location'] = $location;
$_REQUEST['coord'] = $coord; $_REQUEST['coord'] = $coord;
if (($_REQUEST['title'] == "") AND ($_REQUEST['body'] == "")) { if (($_REQUEST['title'] == "") && ($_REQUEST['body'] == "")) {
logger('fromgplus: empty post for user '.$uid." ".print_r($_REQUEST, true)); logger('fromgplus: empty post for user '.$uid." ".print_r($_REQUEST, true));
return; return;
} }
@ -269,13 +269,13 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
else else
$infoFull = array("0" => 0, "1" => 0); $infoFull = array("0" => 0, "1" => 0);
if (($infoPreview[0] >= $infoFull[0]) AND ($infoPreview[1] >= $infoFull[1])) { if (($infoPreview[0] >= $infoFull[0]) && ($infoPreview[1] >= $infoFull[1])) {
$temp = $cleaned["full"]; $temp = $cleaned["full"];
$cleaned["full"] = $cleaned["preview"]; $cleaned["full"] = $cleaned["preview"];
$cleaned["preview"] = $temp; $cleaned["preview"] = $temp;
} }
if (($cleaned["full"] == $cleaned["preview"]) OR (($infoPreview[0] == $infoFull[0]) AND ($infoPreview[1] == $infoFull[1]))) if (($cleaned["full"] == $cleaned["preview"]) || (($infoPreview[0] == $infoFull[0]) && ($infoPreview[1] == $infoFull[1])))
$cleaned["preview"] = ""; $cleaned["preview"] = "";
if ($cleaned["full"] == "") if ($cleaned["full"] == "")
@ -338,7 +338,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
// Add Keywords to page link // Add Keywords to page link
$data = parseurl_getsiteinfo_cached($pagedata["url"], true); $data = parseurl_getsiteinfo_cached($pagedata["url"], true);
if (isset($data["keywords"]) AND get_pconfig($uid, 'fromgplus', 'keywords')) { if (isset($data["keywords"]) && get_pconfig($uid, 'fromgplus', 'keywords')) {
$pagedata["keywords"] = $data["keywords"]; $pagedata["keywords"] = $data["keywords"];
} }
break; break;
@ -366,7 +366,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
$pagedata["images"][1]["src"] = $images["preview"]; $pagedata["images"][1]["src"] = $images["preview"];
} }
if (($attachment->displayName != "") AND (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext))) { if (($attachment->displayName != "") && (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext))) {
$post .= fromgplus_html2bbcode($attachment->displayName)."\n"; $post .= fromgplus_html2bbcode($attachment->displayName)."\n";
$pagedata["title"] = fromgplus_html2bbcode($attachment->displayName); $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
} }
@ -491,7 +491,7 @@ function fromgplus_fetch($a, $uid) {
if (isset($item->location->displayName)) if (isset($item->location->displayName))
$location = $item->location->displayName; $location = $item->location->displayName;
if (isset($item->location->position->latitude) AND if (isset($item->location->position->latitude) &&
isset($item->location->position->longitude)) isset($item->location->position->longitude))
$coord = $item->location->position->latitude." ".$item->location->position->longitude; $coord = $item->location->position->latitude." ".$item->location->position->longitude;
@ -542,7 +542,7 @@ function fromgplus_fetch($a, $uid) {
if (isset($item->location->displayName)) if (isset($item->location->displayName))
$location = $item->location->displayName; $location = $item->location->displayName;
if (isset($item->location->position->latitude) AND if (isset($item->location->position->latitude) &&
isset($item->location->position->longitude)) isset($item->location->position->longitude))
$coord = $item->location->position->latitude." ".$item->location->position->longitude; $coord = $item->location->position->latitude." ".$item->location->position->longitude;

View File

@ -57,7 +57,7 @@ function geocoordinates_resolve_item(&$item) {
return; return;
} }
if (($data->total_results == 0) OR (count($data->results) == 0)) { if (($data->total_results == 0) || (count($data->results) == 0)) {
logger("No results found for coordinates ".$item["coord"], LOGGER_DEBUG); logger("No results found for coordinates ".$item["coord"], LOGGER_DEBUG);
return; return;
} }

View File

@ -98,7 +98,7 @@ function gpluspost_settings(&$a,&$s) {
if (gpluspost_nextscripts()) { if (gpluspost_nextscripts()) {
/* /*
// To-Do: Option to check the credentials if requested // To-Do: Option to check the credentials if requested
if (($username != "") AND ($password != "")) { if (($username != "") && ($password != "")) {
require_once("addon/gpluspost/postToGooglePlus.php"); require_once("addon/gpluspost/postToGooglePlus.php");
$loginError = doConnectToGooglePlus2($username, $password); $loginError = doConnectToGooglePlus2($username, $password);
if ($loginError) if ($loginError)
@ -231,7 +231,7 @@ function gpluspost_send(&$a,&$b) {
return; return;
// if post comes from Google+ don't send it back // if post comes from Google+ don't send it back
if (!get_pconfig($b["uid"],'gpluspost','no_loop_prevention') and (($b['app'] == "Google+") OR ($b["extid"] == NETWORK_GPLUS))) if (!get_pconfig($b["uid"],'gpluspost','no_loop_prevention') && (($b['app'] == "Google+") || ($b["extid"] == NETWORK_GPLUS)))
return; return;
if (!gpluspost_nextscripts()) { if (!gpluspost_nextscripts()) {
@ -527,7 +527,7 @@ function gpluspost_feeditem($pid, $uid) {
else if ($image != "") else if ($image != "")
$msglink = $image; $msglink = $image;
if (($msglink == "") AND $skipwithoutlink) if (($msglink == "") && $skipwithoutlink)
continue; continue;
else if ($msglink == "") else if ($msglink == "")
$msglink = $item["plink"]; $msglink = $item["plink"];

View File

@ -132,7 +132,7 @@ function ifttt_post(&$a) {
if (isset($_REQUEST["url"])) if (isset($_REQUEST["url"]))
$item["url"] = trim($_REQUEST["url"]); $item["url"] = trim($_REQUEST["url"]);
if ((substr($item["msg"], 0, 3) == "<<<") AND (substr($item["msg"], -3, 3) == ">>>")) if ((substr($item["msg"], 0, 3) == "<<<") && (substr($item["msg"], -3, 3) == ">>>"))
$item["msg"] = substr($item["msg"], 3, -3); $item["msg"] = substr($item["msg"], 3, -3);
ifttt_message($uid, $item); ifttt_message($uid, $item);
@ -164,17 +164,16 @@ function ifttt_message($uid, $item) {
if ($item["type"] == "link") { if ($item["type"] == "link") {
$data = query_page_info($item["link"]); $data = query_page_info($item["link"]);
if (isset($item["title"]) AND (trim($item["title"]) != "")) if (isset($item["title"]) && (trim($item["title"]) != ""))
$data["title"] = $item["title"]; $data["title"] = $item["title"];
if (isset($item["description"]) AND (trim($item["description"]) != "")) if (isset($item["description"]) && (trim($item["description"]) != ""))
$data["text"] = $item["description"]; $data["text"] = $item["description"];
$_REQUEST["body"] .= add_page_info_data($data); $_REQUEST["body"] .= add_page_info_data($data);
} elseif (($item["type"] == "photo") AND ($item["image"] != "")) } elseif (($item["type"] == "photo") && ($item["image"] != ""))
$_REQUEST["body"] .= "\n\n[img]".$item["image"]."[/img]\n"; $_REQUEST["body"] .= "\n\n[img]".$item["image"]."[/img]\n";
//print_r($_REQUEST); //print_r($_REQUEST);
item_post($a); item_post($a);
} }
?>

View File

@ -269,7 +269,7 @@ function jappixmini_settings(&$a, &$s) {
if ($server == "") if ($server == "")
$server = get_config("jappixmini", "default_server"); $server = get_config("jappixmini", "default_server");
if (($username == "") and get_config("jappixmini", "default_user")) if (($username == "") && get_config("jappixmini", "default_user"))
$username = $a->user["nickname"]; $username = $a->user["nickname"];
$info_text = get_config("jappixmini", "infotext"); $info_text = get_config("jappixmini", "infotext");
@ -444,7 +444,7 @@ function jappixmini_script(&$a,&$s) {
$activate = get_pconfig(local_user(),'jappixmini','activate'); $activate = get_pconfig(local_user(),'jappixmini','activate');
$dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat'); $dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat');
if (!$activate or $dontinsertchat) return; if (!$activate || $dontinsertchat) return;
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>'."\r\n"; $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;g=mini.xml"></script>'."\r\n";
$a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>'."\r\n"; $a->page['htmlhead'] .= '<script type="text/javascript" src="' . $a->get_baseurl() . '/addon/jappixmini/jappix/php/get.php?t=js&amp;f=presence.js~caps.js~name.js~roster.js"></script>'."\r\n";

View File

@ -86,7 +86,7 @@ function leistungsschutzrecht_fetchsites() {
if (isset($attr["href"])) { if (isset($attr["href"])) {
$urldata = parse_url($attr["href"]); $urldata = parse_url($attr["href"]);
if (isset($urldata["host"]) AND !isset($urldata["path"])) { if (isset($urldata["host"]) && !isset($urldata["path"])) {
$cleanedurlpart = explode("%", $urldata["host"]); $cleanedurlpart = explode("%", $urldata["host"]);
$hostname = explode(".", $cleanedurlpart[0]); $hostname = explode(".", $cleanedurlpart[0]);

View File

@ -122,7 +122,7 @@ function pumpio_connect(&$a) {
$consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret'); $consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret');
$hostname = get_pconfig(local_user(), 'pumpio','host'); $hostname = get_pconfig(local_user(), 'pumpio','host');
if ((($consumer_key == "") OR ($consumer_secret == "")) AND ($hostname != "")) { if ((($consumer_key == "") || ($consumer_secret == "")) && ($hostname != "")) {
logger("pumpio_connect: register client"); logger("pumpio_connect: register client");
$clientdata = pumpio_registerclient($a, $hostname); $clientdata = pumpio_registerclient($a, $hostname);
set_pconfig(local_user(), 'pumpio','consumer_key', $clientdata->client_id); set_pconfig(local_user(), 'pumpio','consumer_key', $clientdata->client_id);
@ -134,7 +134,7 @@ function pumpio_connect(&$a) {
logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG); logger("pumpio_connect: ckey: ".$consumer_key." csecrect: ".$consumer_secret, LOGGER_DEBUG);
} }
if (($consumer_key == "") OR ($consumer_secret == "")) { if (($consumer_key == "") || ($consumer_secret == "")) {
logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname)); logger("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname));
$o .= sprintf(t("Unable to register the client at the pump.io server '%s'."), $hostname); $o .= sprintf(t("Unable to register the client at the pump.io server '%s'."), $hostname);
@ -251,13 +251,13 @@ function pumpio_settings(&$a,&$s) {
$s .= '<input id="pumpio-servername" type="text" name="pumpio_host" value="'.$servername.'" />'; $s .= '<input id="pumpio-servername" type="text" name="pumpio_host" value="'.$servername.'" />';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
if (($username != '') AND ($servername != '')) { if (($username != '') && ($servername != '')) {
$oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token"); $oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token");
$oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret"); $oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret");
$s .= '<div id="pumpio-password-wrapper">'; $s .= '<div id="pumpio-password-wrapper">';
if (($oauth_token == "") OR ($oauth_token_secret == "")) { if (($oauth_token == "") || ($oauth_token_secret == "")) {
$s .= '<div id="pumpio-authenticate-wrapper">'; $s .= '<div id="pumpio-authenticate-wrapper">';
$s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.t("Authenticate your pump.io connection").'</a>'; $s .= '<a href="'.$a->get_baseurl().'/pumpio/connect">'.t("Authenticate your pump.io connection").'</a>';
$s .= '</div><div class="clear"></div>'; $s .= '</div><div class="clear"></div>';
@ -403,7 +403,7 @@ function pumpio_send(&$a,&$b) {
logger("pumpio_send: receiver ".print_r($receiver, true)); logger("pumpio_send: receiver ".print_r($receiver, true));
if (!count($receiver) AND ($b['private'] OR !strstr($b['postopts'],'pumpio'))) if (!count($receiver) && ($b['private'] || !strstr($b['postopts'],'pumpio')))
return; return;
} }
@ -418,10 +418,10 @@ function pumpio_send(&$a,&$b) {
if($b['verb'] == ACTIVITY_DISLIKE) if($b['verb'] == ACTIVITY_DISLIKE)
return; return;
if (($b['verb'] == ACTIVITY_POST) AND ($b['created'] !== $b['edited']) AND !$b['deleted']) if (($b['verb'] == ACTIVITY_POST) && ($b['created'] !== $b['edited']) && !$b['deleted'])
pumpio_action($a, $b["uid"], $b["uri"], "update", $b["body"]); pumpio_action($a, $b["uid"], $b["uri"], "update", $b["body"]);
if (($b['verb'] == ACTIVITY_POST) AND $b['deleted']) if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
pumpio_action($a, $b["uid"], $b["uri"], "delete"); pumpio_action($a, $b["uid"], $b["uri"], "delete");
if($b['deleted'] || ($b['created'] !== $b['edited'])) if($b['deleted'] || ($b['created'] !== $b['edited']))
@ -480,7 +480,7 @@ function pumpio_send(&$a,&$b) {
$inReplyTo = array("id" => $orig_post["uri"], $inReplyTo = array("id" => $orig_post["uri"],
"objectType" => "note"); "objectType" => "note");
if (($orig_post["object-type"] != "") AND (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA))) if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
$inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]); $inReplyTo["objectType"] = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
$params["object"] = array( $params["object"] = array(
@ -516,7 +516,7 @@ function pumpio_send(&$a,&$b) {
$post_id = $user->object->id; $post_id = $user->object->id;
logger('pumpio_send '.$username.': success '.$post_id); logger('pumpio_send '.$username.': success '.$post_id);
if($post_id AND $iscomment) { if($post_id && $iscomment) {
logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']); logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$b['id']);
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
dbesc($post_id), dbesc($post_id),
@ -562,12 +562,12 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") {
$orig_post = $r[0]; $orig_post = $r[0];
if ($orig_post["extid"] AND !strstr($orig_post["extid"], "/proxy/")) if ($orig_post["extid"] && !strstr($orig_post["extid"], "/proxy/"))
$uri = $orig_post["extid"]; $uri = $orig_post["extid"];
else else
$uri = $orig_post["uri"]; $uri = $orig_post["uri"];
if (($orig_post["object-type"] != "") AND (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA))) if (($orig_post["object-type"] != "") && (strstr($orig_post["object-type"], NAMESPACE_ACTIVITY_SCHEMA)))
$objectType = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]); $objectType = str_replace(NAMESPACE_ACTIVITY_SCHEMA, '', $orig_post["object-type"]);
elseif (strstr($uri, "/api/comment/")) elseif (strstr($uri, "/api/comment/"))
$objectType = "comment"; $objectType = "comment";
@ -763,7 +763,7 @@ function pumpio_fetchtimeline(&$a, $uid) {
if ($receiver->id == "http://activityschema.org/collection/public") if ($receiver->id == "http://activityschema.org/collection/public")
$public = true; $public = true;
if ($public AND !stristr($post->generator->displayName, $application_name)) { if ($public && !stristr($post->generator->displayName, $application_name)) {
require_once('include/html2bbcode.php'); require_once('include/html2bbcode.php');
$_SESSION["authenticated"] = true; $_SESSION["authenticated"] = true;
@ -1060,10 +1060,10 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
require_once('include/items.php'); require_once('include/items.php');
require_once('include/html2bbcode.php'); require_once('include/html2bbcode.php');
if (($post->verb == "like") OR ($post->verb == "favorite")) if (($post->verb == "like") || ($post->verb == "favorite"))
return pumpio_dolike($a, $uid, $self, $post, $own_id); return pumpio_dolike($a, $uid, $self, $post, $own_id);
if (($post->verb == "unlike") OR ($post->verb == "unfavorite")) if (($post->verb == "unlike") || ($post->verb == "unfavorite"))
return pumpio_dounlike($a, $uid, $self, $post, $own_id); return pumpio_dounlike($a, $uid, $self, $post, $own_id);
if ($post->verb == "delete") if ($post->verb == "delete")
@ -1206,9 +1206,9 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
if ($post->verb == "share") { if ($post->verb == "share") {
if (!intval(get_config('system','wall-to-wall_share'))) { if (!intval(get_config('system','wall-to-wall_share'))) {
if (isset($post->object->author->displayName) AND ($post->object->author->displayName != "")) if (isset($post->object->author->displayName) && ($post->object->author->displayName != ""))
$share_author = $post->object->author->displayName; $share_author = $post->object->author->displayName;
elseif (isset($post->object->author->preferredUsername) AND ($post->object->author->preferredUsername != "")) elseif (isset($post->object->author->preferredUsername) && ($post->object->author->preferredUsername != ""))
$share_author = $post->object->author->preferredUsername; $share_author = $post->object->author->preferredUsername;
else else
$share_author = $post->object->author->url; $share_author = $post->object->author->url;
@ -1240,7 +1240,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
$top_item = item_store($postarray); $top_item = item_store($postarray);
$postarray["id"] = $top_item; $postarray["id"] = $top_item;
if (($top_item == 0) AND ($post->verb == "update")) { if (($top_item == 0) && ($post->verb == "update")) {
$r = q("UPDATE `item` SET `title` = '%s', `body` = '%s' , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d", $r = q("UPDATE `item` SET `title` = '%s', `body` = '%s' , `changed` = '%s' WHERE `uri` = '%s' AND `uid` = %d",
dbesc($postarray["title"]), dbesc($postarray["title"]),
dbesc($postarray["body"]), dbesc($postarray["body"]),
@ -1278,7 +1278,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
foreach($myconv as $conv) { foreach($myconv as $conv) {
// now if we find a match, it means we're in this conversation // now if we find a match, it means we're in this conversation
if(!link_compare($conv['author-link'],$importer_url) AND !link_compare($conv['author-link'],$own_id)) if(!link_compare($conv['author-link'],$importer_url) && !link_compare($conv['author-link'],$own_id))
continue; continue;
require_once('include/enotify.php'); require_once('include/enotify.php');
@ -1427,7 +1427,7 @@ function pumpio_queue_hook(&$a,&$b) {
logger('pumpio_queue: run'); logger('pumpio_queue: run');
$r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` on `contact`.`uid` = `user`.`uid` $r = q("SELECT `user`.* FROM `user` LEFT JOIN `contact` ON `contact`.`uid` = `user`.`uid`
WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1", WHERE `contact`.`self` = 1 AND `contact`.`id` = %d LIMIT 1",
intval($x['cid']) intval($x['cid'])
); );
@ -1448,8 +1448,8 @@ function pumpio_queue_hook(&$a,&$b) {
$success = false; $success = false;
if ($oauth_token AND $oauth_token_secret AND if ($oauth_token && $oauth_token_secret &&
$consumer_key AND $consumer_secret) { $consumer_key && $consumer_secret) {
$username = $user.'@'.$host; $username = $user.'@'.$host;
logger('pumpio_queue: able to post for user '.$username); logger('pumpio_queue: able to post for user '.$username);
@ -1473,7 +1473,7 @@ function pumpio_queue_hook(&$a,&$b) {
if($success) { if($success) {
$post_id = $user->object->id; $post_id = $user->object->id;
logger('pumpio_queue: send '.$username.': success '.$post_id); logger('pumpio_queue: send '.$username.': success '.$post_id);
if($post_id AND $iscomment) { if($post_id && $iscomment) {
logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']); logger('pumpio_send '.$username.': Update extid '.$post_id." for post id ".$z['item']);
q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d",
dbesc($post_id), dbesc($post_id),

View File

@ -2,7 +2,7 @@
use Friendica\App; use Friendica\App;
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) { if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]); $directory = dirname($_SERVER["argv"][0]);
if (substr($directory, 0, 1) != "/") if (substr($directory, 0, 1) != "/")

View File

@ -29,7 +29,7 @@ function rendertime_page_end(&$a, &$o) {
$ignored_modules = array("fbrowser"); $ignored_modules = array("fbrowser");
$ignored = in_array($a->module, $ignored_modules); $ignored = in_array($a->module, $ignored_modules);
if (is_site_admin() AND ($_GET["mode"] != "minimal") AND !$a->is_mobile AND !$a->is_tablet AND !$ignored) { if (is_site_admin() && ($_GET["mode"] != "minimal") && !$a->is_mobile && !$a->is_tablet && !$ignored) {
$o = $o.'<div class="renderinfo">'.sprintf(t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"), $o = $o.'<div class="renderinfo">'.sprintf(t("Database: %s/%s, Network: %s, Rendering: %s, Session: %s, I/O: %s, Other: %s, Total: %s"),
round($a->performance["database"] - $a->performance["database_write"], 3), round($a->performance["database"] - $a->performance["database_write"], 3),
round($a->performance["database_write"], 3), round($a->performance["database_write"], 3),

View File

@ -110,11 +110,11 @@ function statistics_json_cron($a,$b) {
$month = time() - (30 * 24 * 60 * 60); $month = time() - (30 * 24 * 60 * 60);
foreach ($users AS $user) { foreach ($users AS $user) {
if ((strtotime($user['login_date']) > $halfyear) OR if ((strtotime($user['login_date']) > $halfyear) ||
(strtotime($user['lastitem_date']) > $halfyear)) (strtotime($user['lastitem_date']) > $halfyear))
++$active_users_halfyear; ++$active_users_halfyear;
if ((strtotime($user['login_date']) > $month) OR if ((strtotime($user['login_date']) > $month) ||
(strtotime($user['lastitem_date']) > $month)) (strtotime($user['lastitem_date']) > $month))
++$active_users_monthly; ++$active_users_monthly;

View File

@ -494,8 +494,8 @@ function statusnet_post_hook(&$a,&$b) {
// Looking if its a reply to a GNU Social post // Looking if its a reply to a GNU Social post
$hostlength = strlen($hostname) + 2; $hostlength = strlen($hostname) + 2;
if ((substr($b["parent-uri"], 0, $hostlength) != $hostname."::") AND (substr($b["extid"], 0, $hostlength) != $hostname."::") if ((substr($b["parent-uri"], 0, $hostlength) != $hostname."::") && (substr($b["extid"], 0, $hostlength) != $hostname."::")
AND (substr($b["thr-parent"], 0, $hostlength) != $hostname."::")) { && (substr($b["thr-parent"], 0, $hostlength) != $hostname."::")) {
logger("statusnet_post_hook: no GNU Social post ".$b["parent"]); logger("statusnet_post_hook: no GNU Social post ".$b["parent"]);
return; return;
} }
@ -523,18 +523,18 @@ function statusnet_post_hook(&$a,&$b) {
$nicknameplain = "@".$nick; $nicknameplain = "@".$nick;
logger("statusnet_post_hook: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG); logger("statusnet_post_hook: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG);
if ((strpos($b["body"], $nickname) === false) AND (strpos($b["body"], $nicknameplain) === false)) if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false))
$b["body"] = $nickname." ".$b["body"]; $b["body"] = $nickname." ".$b["body"];
logger("statusnet_post_hook: parent found ".print_r($orig_post, true), LOGGER_DEBUG); logger("statusnet_post_hook: parent found ".print_r($orig_post, true), LOGGER_DEBUG);
} else { } else {
$iscomment = false; $iscomment = false;
if($b['private'] OR !strstr($b['postopts'],'statusnet')) if($b['private'] || !strstr($b['postopts'],'statusnet'))
return; return;
} }
if (($b['verb'] == ACTIVITY_POST) AND $b['deleted']) if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete"); statusnet_action($a, $b["uid"], substr($orig_post["uri"], $hostlength), "delete");
if($b['verb'] == ACTIVITY_LIKE) { if($b['verb'] == ACTIVITY_LIKE) {
@ -584,18 +584,18 @@ function statusnet_post_hook(&$a,&$b) {
$msgarr = plaintext($a, $b, $max_char, true, 7); $msgarr = plaintext($a, $b, $max_char, true, 7);
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (($msg == "") AND isset($msgarr["title"])) if (($msg == "") && isset($msgarr["title"]))
$msg = shortenmsg($msgarr["title"], $max_char - 50); $msg = shortenmsg($msgarr["title"], $max_char - 50);
$image = ""; $image = "";
if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) { if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) {
if ((strlen($msgarr["url"]) > 20) AND if ((strlen($msgarr["url"]) > 20) &&
((strlen($msg." \n".$msgarr["url"]) > $max_char))) ((strlen($msg." \n".$msgarr["url"]) > $max_char)))
$msg .= " \n".short_link($msgarr["url"]); $msg .= " \n".short_link($msgarr["url"]);
else else
$msg .= " \n".$msgarr["url"]; $msg .= " \n".$msgarr["url"];
} elseif (isset($msgarr["image"]) AND ($msgarr["type"] != "video")) } elseif (isset($msgarr["image"]) && ($msgarr["type"] != "video"))
$image = $msgarr["image"]; $image = $msgarr["image"];
if ($image != "") { if ($image != "") {
@ -738,7 +738,7 @@ function statusnet_prepare_body(&$a,&$b) {
$nickname = "@[url=".$orig_post["author-link"]."]".$nick."[/url]"; $nickname = "@[url=".$orig_post["author-link"]."]".$nick."[/url]";
$nicknameplain = "@".$nick; $nicknameplain = "@".$nick;
if ((strpos($item["body"], $nickname) === false) AND (strpos($item["body"], $nicknameplain) === false)) if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false))
$item["body"] = $nickname." ".$item["body"]; $item["body"] = $nickname." ".$item["body"];
} }
@ -746,7 +746,7 @@ function statusnet_prepare_body(&$a,&$b) {
$msgarr = plaintext($a, $item, $max_char, true, 7); $msgarr = plaintext($a, $item, $max_char, true, 7);
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) if (isset($msgarr["url"]) && ($msgarr["type"] != "photo"))
$msg .= " ".$msgarr["url"]; $msg .= " ".$msgarr["url"];
if (isset($msgarr["image"])) if (isset($msgarr["image"]))
@ -929,10 +929,10 @@ function statusnet_fetch_contact($uid, $contact, $create_user) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' AND `network` = '%s'LIMIT 1",
intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET)); intval($uid), dbesc(normalise_link($contact->statusnet_profile_url)), dbesc(NETWORK_STATUSNET));
if(!count($r) AND !$create_user) if(!count($r) && !$create_user)
return(0); return(0);
if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) { if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("statusnet_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); logger("statusnet_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return(-1); return(-1);
} }
@ -1179,7 +1179,7 @@ function statusnet_createpost($a, $uid, $post, $self, $create_user, $only_existi
$postarray['owner-link'] = $post->user->statusnet_profile_url; $postarray['owner-link'] = $post->user->statusnet_profile_url;
$postarray['owner-avatar'] = $post->user->profile_image_url; $postarray['owner-avatar'] = $post->user->profile_image_url;
} }
if(($contactid == 0) AND !$only_existing_contact) if(($contactid == 0) && !$only_existing_contact)
$contactid = $self['id']; $contactid = $self['id'];
elseif ($contactid <= 0) elseif ($contactid <= 0)
return(array()); return(array());
@ -1279,7 +1279,7 @@ function statusnet_checknotification($a, $uid, $own_url, $top_item, $postarray)
foreach($myconv as $conv) { foreach($myconv as $conv) {
// now if we find a match, it means we're in this conversation // now if we find a match, it means we're in this conversation
if(!link_compare($conv['author-link'],$user[0]["url"]) AND !link_compare($conv['author-link'],$own_user[0]["url"])) if(!link_compare($conv['author-link'],$user[0]["url"]) && !link_compare($conv['author-link'],$own_user[0]["url"]))
continue; continue;
require_once('include/enotify.php'); require_once('include/enotify.php');
@ -1375,11 +1375,11 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
$items = $connection->get('statuses/home_timeline', $parameters); $items = $connection->get('statuses/home_timeline', $parameters);
if (!is_array($items)) { if (!is_array($items)) {
if (is_object($items) AND isset($items->error)) if (is_object($items) && isset($items->error))
$errormsg = $items->error; $errormsg = $items->error;
elseif (is_object($items)) elseif (is_object($items))
$errormsg = print_r($items, true); $errormsg = print_r($items, true);
elseif (is_string($items) OR is_float($items) OR is_int($items)) elseif (is_string($items) || is_float($items) || is_int($items))
$errormsg = $items; $errormsg = $items;
else else
$errormsg = "Unknown error"; $errormsg = "Unknown error";
@ -1417,7 +1417,7 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item); logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item);
if ($item AND !function_exists("check_item_notification")) if ($item && !function_exists("check_item_notification"))
statusnet_checknotification($a, $uid, $nick, $item, $postarray); statusnet_checknotification($a, $uid, $nick, $item, $postarray);
} }
@ -1468,7 +1468,7 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item); logger('statusnet_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item);
if ($item AND function_exists("check_item_notification")) if ($item && function_exists("check_item_notification"))
check_item_notification($item, $uid, NOTIFY_TAGSELF); check_item_notification($item, $uid, NOTIFY_TAGSELF);
} }
} }
@ -1482,7 +1482,7 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) {
$parent_id = $r[0]['parent']; $parent_id = $r[0]['parent'];
} }
if (($item != 0) AND !function_exists("check_item_notification")) { if (($item != 0) && !function_exists("check_item_notification")) {
require_once('include/enotify.php'); require_once('include/enotify.php');
notification(array( notification(array(
'type' => NOTIFY_TAGSELF, 'type' => NOTIFY_TAGSELF,
@ -1537,7 +1537,7 @@ function statusnet_complete_conversation($a, $uid, $self, $create_user, $nick, $
logger('statusnet_complete_conversation: User '.$self["nick"].' posted home timeline item '.$item); logger('statusnet_complete_conversation: User '.$self["nick"].' posted home timeline item '.$item);
if ($item AND !function_exists("check_item_notification")) if ($item && !function_exists("check_item_notification"))
statusnet_checknotification($a, $uid, $nick, $item, $postarray); statusnet_checknotification($a, $uid, $nick, $item, $postarray);
} }
} }
@ -1582,7 +1582,7 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
$footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]"; $footerlink = "[url=".$expanded_url."]".$expanded_url."[/url]";
$body = str_replace($search, $footerlink, $body); $body = str_replace($search, $footerlink, $body);
} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) } elseif (($oembed_data->type == "photo") && isset($oembed_data->url) && !$dontincludemedia)
$body = str_replace($search, "[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]", $body); $body = str_replace($search, "[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]", $body);
elseif ($oembed_data->type != "link") elseif ($oembed_data->type != "link")
$body = str_replace($search, "[url=".$expanded_url."]".$expanded_url."[/url]", $body); $body = str_replace($search, "[url=".$expanded_url."]".$expanded_url."[/url]", $body);
@ -1610,10 +1610,10 @@ function statusnet_convertmsg($a, $body, $no_tags = false) {
if ($footerurl != "") if ($footerurl != "")
$footer = add_page_info($footerurl); $footer = add_page_info($footerurl);
if (($footerlink != "") AND (trim($footer) != "")) { if (($footerlink != "") && (trim($footer) != "")) {
$removedlink = trim(str_replace($footerlink, "", $body)); $removedlink = trim(str_replace($footerlink, "", $body));
if (($removedlink == "") OR strstr($body, $removedlink)) if (($removedlink == "") || strstr($body, $removedlink))
$body = $removedlink; $body = $removedlink;
$body .= $footer; $body .= $footer;

View File

@ -227,7 +227,7 @@ function tumblr_settings(&$a,&$s) {
$oauth_token_secret = get_pconfig(local_user(), "tumblr", "oauth_token_secret"); $oauth_token_secret = get_pconfig(local_user(), "tumblr", "oauth_token_secret");
$s .= '<div id="tumblr-page-wrapper">'; $s .= '<div id="tumblr-page-wrapper">';
if (($oauth_token != "") and ($oauth_token_secret != "")) { if (($oauth_token != "") && ($oauth_token_secret != "")) {
$page = get_pconfig(local_user(),'tumblr','page'); $page = get_pconfig(local_user(),'tumblr','page');
$consumer_key = get_config('tumblr','consumer_key'); $consumer_key = get_config('tumblr','consumer_key');
@ -350,7 +350,7 @@ function tumblr_send(&$a,&$b) {
if (!isset($siteinfo["type"])) if (!isset($siteinfo["type"]))
$siteinfo["type"] = ""; $siteinfo["type"] = "";
if (($title == "") AND isset($siteinfo["title"])) if (($title == "") && isset($siteinfo["title"]))
$title = $siteinfo["title"]; $title = $siteinfo["title"];
if (isset($siteinfo["text"])) if (isset($siteinfo["text"]))
@ -391,7 +391,7 @@ function tumblr_send(&$a,&$b) {
break; break;
} }
if (isset($params['caption']) AND (trim($title) != "")) if (isset($params['caption']) && (trim($title) != ""))
$params['caption'] = '<h1>'.$title."</h1>". $params['caption'] = '<h1>'.$title."</h1>".
"<p>".$params['caption']."</p>"; "<p>".$params['caption']."</p>";

View File

@ -118,7 +118,7 @@ function twitter_follow($a, &$contact) {
logger("twitter_follow: Check if contact is twitter contact. ".$contact["url"], LOGGER_DEBUG); logger("twitter_follow: Check if contact is twitter contact. ".$contact["url"], LOGGER_DEBUG);
if (!strstr($contact["url"], "://twitter.com") AND !strstr($contact["url"], "@twitter.com")) if (!strstr($contact["url"], "://twitter.com") && !strstr($contact["url"], "@twitter.com"))
return; return;
// contact seems to be a twitter contact, so continue // contact seems to be a twitter contact, so continue
@ -405,7 +405,7 @@ function twitter_post_hook(&$a,&$b) {
logger("twitter_post_hook: parameter ".print_r($b, true), LOGGER_DATA); logger("twitter_post_hook: parameter ".print_r($b, true), LOGGER_DATA);
// Looking if its a reply to a twitter post // Looking if its a reply to a twitter post
if ((substr($b["parent-uri"], 0, 9) != "twitter::") AND (substr($b["extid"], 0, 9) != "twitter::") AND (substr($b["thr-parent"], 0, 9) != "twitter::")) { if ((substr($b["parent-uri"], 0, 9) != "twitter::") && (substr($b["extid"], 0, 9) != "twitter::") && (substr($b["thr-parent"], 0, 9) != "twitter::")) {
logger("twitter_post_hook: no twitter post ".$b["parent"]); logger("twitter_post_hook: no twitter post ".$b["parent"]);
return; return;
} }
@ -428,18 +428,18 @@ function twitter_post_hook(&$a,&$b) {
$nicknameplain = "@".$nicknameplain; $nicknameplain = "@".$nicknameplain;
logger("twitter_post_hook: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG); logger("twitter_post_hook: comparing ".$nickname." and ".$nicknameplain." with ".$b["body"], LOGGER_DEBUG);
if ((strpos($b["body"], $nickname) === false) AND (strpos($b["body"], $nicknameplain) === false)) if ((strpos($b["body"], $nickname) === false) && (strpos($b["body"], $nicknameplain) === false))
$b["body"] = $nickname." ".$b["body"]; $b["body"] = $nickname." ".$b["body"];
logger("twitter_post_hook: parent found ".print_r($orig_post, true), LOGGER_DATA); logger("twitter_post_hook: parent found ".print_r($orig_post, true), LOGGER_DATA);
} else { } else {
$iscomment = false; $iscomment = false;
if($b['private'] OR !strstr($b['postopts'],'twitter')) if($b['private'] || !strstr($b['postopts'],'twitter'))
return; return;
} }
if (($b['verb'] == ACTIVITY_POST) AND $b['deleted']) if (($b['verb'] == ACTIVITY_POST) && $b['deleted'])
twitter_action($a, $b["uid"], substr($orig_post["uri"], 9), "delete"); twitter_action($a, $b["uid"], substr($orig_post["uri"], 9), "delete");
if($b['verb'] == ACTIVITY_LIKE) { if($b['verb'] == ACTIVITY_LIKE) {
@ -487,19 +487,19 @@ function twitter_post_hook(&$a,&$b) {
$msgarr = plaintext($a, $b, $max_char, true, 8); $msgarr = plaintext($a, $b, $max_char, true, 8);
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (($msg == "") AND isset($msgarr["title"])) if (($msg == "") && isset($msgarr["title"]))
$msg = shortenmsg($msgarr["title"], $max_char - 50); $msg = shortenmsg($msgarr["title"], $max_char - 50);
$image = ""; $image = "";
if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) if (isset($msgarr["url"]) && ($msgarr["type"] != "photo"))
$msg .= "\n".$msgarr["url"]; $msg .= "\n".$msgarr["url"];
if (isset($msgarr["image"]) AND ($msgarr["type"] != "video")) if (isset($msgarr["image"]) && ($msgarr["type"] != "video"))
$image = $msgarr["image"]; $image = $msgarr["image"];
// and now tweet it :-) // and now tweet it :-)
if(strlen($msg) and ($image != "")) { if(strlen($msg) && ($image != "")) {
$img_str = fetch_url($image); $img_str = fetch_url($image);
$tempfile = tempnam(get_temppath(), "cache"); $tempfile = tempnam(get_temppath(), "cache");
@ -528,7 +528,7 @@ function twitter_post_hook(&$a,&$b) {
if ($result->source) if ($result->source)
set_config("twitter", "application_name", strip_tags($result->source)); set_config("twitter", "application_name", strip_tags($result->source));
if ($result->errors OR $result->error) { if ($result->errors || $result->error) {
logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"'); logger('Send to Twitter failed: "' . print_r($result->errors, true) . '"');
// Workaround: Remove the picture link so that the post can be reposted without it // Workaround: Remove the picture link so that the post can be reposted without it
@ -544,7 +544,7 @@ function twitter_post_hook(&$a,&$b) {
} }
} }
if(strlen($msg) and ($image == "")) { if(strlen($msg) && ($image == "")) {
$url = 'statuses/update'; $url = 'statuses/update';
$post = array('status' => $msg); $post = array('status' => $msg);
@ -734,7 +734,7 @@ function twitter_prepare_body(&$a,&$b) {
$nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]"; $nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]";
$nicknameplain = "@".$nicknameplain; $nicknameplain = "@".$nicknameplain;
if ((strpos($item["body"], $nickname) === false) AND (strpos($item["body"], $nicknameplain) === false)) if ((strpos($item["body"], $nickname) === false) && (strpos($item["body"], $nicknameplain) === false))
$item["body"] = $nickname." ".$item["body"]; $item["body"] = $nickname." ".$item["body"];
} }
@ -742,7 +742,7 @@ function twitter_prepare_body(&$a,&$b) {
$msgarr = plaintext($a, $item, $max_char, true, 8); $msgarr = plaintext($a, $item, $max_char, true, 8);
$msg = $msgarr["text"]; $msg = $msgarr["text"];
if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) if (isset($msgarr["url"]) && ($msgarr["type"] != "photo"))
$msg .= " ".$msgarr["url"]; $msg .= " ".$msgarr["url"];
if (isset($msgarr["image"])) if (isset($msgarr["image"]))
@ -891,7 +891,7 @@ function twitter_queue_hook(&$a,&$b) {
$success = false; $success = false;
if ($ckey AND $csecret AND $otoken AND $osecret) { if ($ckey && $csecret && $otoken && $osecret) {
logger('twitter_queue: able to post'); logger('twitter_queue: able to post');
@ -952,10 +952,10 @@ function twitter_fetch_contact($uid, $contact, $create_user) {
$r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1", $r = q("SELECT * FROM `contact` WHERE `uid` = %d AND `alias` = '%s' LIMIT 1",
intval($uid), dbesc("twitter::".$contact->id_str)); intval($uid), dbesc("twitter::".$contact->id_str));
if(!count($r) AND !$create_user) if(!count($r) && !$create_user)
return(0); return(0);
if (count($r) AND ($r[0]["readonly"] OR $r[0]["blocked"])) { if (count($r) && ($r[0]["readonly"] || $r[0]["blocked"])) {
logger("twitter_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG); logger("twitter_fetch_contact: Contact '".$r[0]["nick"]."' is blocked or readonly.", LOGGER_DEBUG);
return(-1); return(-1);
} }
@ -1135,14 +1135,14 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
$plain = str_replace($url->url, '', $plain); $plain = str_replace($url->url, '', $plain);
if ($url->url AND $url->expanded_url AND $url->display_url) { if ($url->url && $url->expanded_url && $url->display_url) {
$expanded_url = original_url($url->expanded_url); $expanded_url = original_url($url->expanded_url);
$oembed_data = oembed_fetch_url($expanded_url); $oembed_data = oembed_fetch_url($expanded_url);
// Quickfix: Workaround for URL with "[" and "]" in it // Quickfix: Workaround for URL with "[" and "]" in it
if (strpos($expanded_url, "[") OR strpos($expanded_url, "]")) if (strpos($expanded_url, "[") || strpos($expanded_url, "]"))
$expanded_url = $url->url; $expanded_url = $url->url;
if ($type == "") if ($type == "")
@ -1158,7 +1158,7 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
$body = str_replace($url->url, $footerlink, $body); $body = str_replace($url->url, $footerlink, $body);
//} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) { //} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url) AND !$dontincludemedia) {
} elseif (($oembed_data->type == "photo") AND isset($oembed_data->url)) { } elseif (($oembed_data->type == "photo") && isset($oembed_data->url)) {
$body = str_replace($url->url, $body = str_replace($url->url,
"[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]", "[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]",
$body); $body);
@ -1193,18 +1193,18 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) {
if ($footerurl != "") if ($footerurl != "")
$footer = add_page_info($footerurl, false, $picture); $footer = add_page_info($footerurl, false, $picture);
if (($footerlink != "") AND (trim($footer) != "")) { if (($footerlink != "") && (trim($footer) != "")) {
$removedlink = trim(str_replace($footerlink, "", $body)); $removedlink = trim(str_replace($footerlink, "", $body));
if (($removedlink == "") OR strstr($body, $removedlink)) if (($removedlink == "") || strstr($body, $removedlink))
$body = $removedlink; $body = $removedlink;
$body .= $footer; $body .= $footer;
} }
if (($footer == "") AND ($picture != "")) if (($footer == "") && ($picture != ""))
$body .= "\n\n[img]".$picture."[/img]\n"; $body .= "\n\n[img]".$picture."[/img]\n";
elseif (($footer == "") AND ($picture == "")) elseif (($footer == "") && ($picture == ""))
$body = add_page_info_to_body($body); $body = add_page_info_to_body($body);
if ($no_tags) if ($no_tags)
@ -1284,7 +1284,7 @@ function twitter_media_entities($post, &$postarray) {
// When the post links to an external page, we only take one picture. // When the post links to an external page, we only take one picture.
// We only do this when there is exactly one media. // We only do this when there is exactly one media.
if ((count($post->entities->urls) > 0) AND (count($post->extended_entities->media) == 1)) { if ((count($post->entities->urls) > 0) && (count($post->extended_entities->media) == 1)) {
$picture = ""; $picture = "";
foreach($post->extended_entities->media AS $medium) { foreach($post->extended_entities->media AS $medium) {
if (isset($medium->media_url_https)) { if (isset($medium->media_url_https)) {
@ -1311,7 +1311,7 @@ function twitter_media_entities($post, &$postarray) {
$bitrate = 0; $bitrate = 0;
// We take the video with the highest bitrate // We take the video with the highest bitrate
foreach ($medium->video_info->variants AS $variant) { foreach ($medium->video_info->variants AS $variant) {
if (($variant->content_type == "video/mp4") AND ($variant->bitrate >= $bitrate)) { if (($variant->content_type == "video/mp4") && ($variant->bitrate >= $bitrate)) {
$media[$medium->url] = "\n[video]".$variant->url."[/video]"; $media[$medium->url] = "\n[video]".$variant->url."[/video]";
$bitrate = $variant->bitrate; $bitrate = $variant->bitrate;
} }
@ -1417,7 +1417,7 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing
$postarray['owner-avatar'] = twitter_fix_avatar($post->user->profile_image_url_https); $postarray['owner-avatar'] = twitter_fix_avatar($post->user->profile_image_url_https);
} }
if(($contactid == 0) AND !$only_existing_contact) { if(($contactid == 0) && !$only_existing_contact) {
$contactid = $self['id']; $contactid = $self['id'];
} elseif ($contactid <= 0) { } elseif ($contactid <= 0) {
logger("Contact ID is zero or less than zero.", LOGGER_DEBUG); logger("Contact ID is zero or less than zero.", LOGGER_DEBUG);
@ -1486,7 +1486,7 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing
$postarray = $retweet; $postarray = $retweet;
} }
if (is_object($post->quoted_status) AND !$noquote) { if (is_object($post->quoted_status) && !$noquote) {
$quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true); $quoted = twitter_createpost($a, $uid, $post->quoted_status, $self, false, false, true);
$postarray['body'] = $statustext; $postarray['body'] = $statustext;
@ -1537,7 +1537,7 @@ function twitter_checknotification($a, $uid, $own_id, $top_item, $postarray) {
foreach($myconv as $conv) { foreach($myconv as $conv) {
// now if we find a match, it means we're in this conversation // now if we find a match, it means we're in this conversation
if(!link_compare($conv['author-link'],$user[0]["url"]) AND !link_compare($conv['author-link'],$own_user[0]["url"])) if(!link_compare($conv['author-link'],$user[0]["url"]) && !link_compare($conv['author-link'],$own_user[0]["url"]))
continue; continue;
require_once('include/enotify.php'); require_once('include/enotify.php');
@ -1609,7 +1609,7 @@ function twitter_fetchparentposts($a, $uid, $post, $connection, $self, $own_id)
logger('twitter_fetchparentpost: User '.$self["nick"].' posted parent timeline item '.$item); logger('twitter_fetchparentpost: User '.$self["nick"].' posted parent timeline item '.$item);
if ($item AND !function_exists("check_item_notification")) if ($item && !function_exists("check_item_notification"))
twitter_checknotification($a, $uid, $own_id, $item, $postarray); twitter_checknotification($a, $uid, $own_id, $item, $postarray);
} }
} }
@ -1721,7 +1721,7 @@ function twitter_fetchhometimeline($a, $uid) {
logger('twitter_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item); logger('twitter_fetchhometimeline: User '.$self["nick"].' posted home timeline item '.$item);
if ($item AND !function_exists("check_item_notification")) if ($item && !function_exists("check_item_notification"))
twitter_checknotification($a, $uid, $own_id, $item, $postarray); twitter_checknotification($a, $uid, $own_id, $item, $postarray);
} }
@ -1766,10 +1766,10 @@ function twitter_fetchhometimeline($a, $uid) {
$item = item_store($postarray); $item = item_store($postarray);
$postarray["id"] = $item; $postarray["id"] = $item;
if ($item AND function_exists("check_item_notification")) if ($item && function_exists("check_item_notification"))
check_item_notification($item, $uid, NOTIFY_TAGSELF); check_item_notification($item, $uid, NOTIFY_TAGSELF);
if (!isset($postarray["parent"]) OR ($postarray["parent"] == 0)) if (!isset($postarray["parent"]) || ($postarray["parent"] == 0))
$postarray["parent"] = $item; $postarray["parent"] = $item;
logger('twitter_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item); logger('twitter_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item);
@ -1786,7 +1786,7 @@ function twitter_fetchhometimeline($a, $uid) {
} else } else
$parent_id = $postarray['parent']; $parent_id = $postarray['parent'];
if (($item != 0) AND !function_exists("check_item_notification")) { if (($item != 0) && !function_exists("check_item_notification")) {
require_once('include/enotify.php'); require_once('include/enotify.php');
notification(array( notification(array(
'type' => NOTIFY_TAGSELF, 'type' => NOTIFY_TAGSELF,

View File

@ -2,7 +2,7 @@
use Friendica\App; use Friendica\App;
if (!file_exists("boot.php") AND (sizeof($_SERVER["argv"]) != 0)) { if (!file_exists("boot.php") && (sizeof($_SERVER["argv"]) != 0)) {
$directory = dirname($_SERVER["argv"][0]); $directory = dirname($_SERVER["argv"][0]);
if (substr($directory, 0, 1) != "/") if (substr($directory, 0, 1) != "/")

View File

@ -257,7 +257,7 @@ function wppost_send(&$a,&$b) {
$title = html2plain(bbcode($title, false, false), 0, true)."\n"; $title = html2plain(bbcode($title, false, false), 0, true)."\n";
$pos = strpos($title, "\n"); $pos = strpos($title, "\n");
$trailer = ""; $trailer = "";
if (($pos == 0) or ($pos > 100)) { if (($pos == 0) || ($pos > 100)) {
$pos = 100; $pos = 100;
$trailer = "..."; $trailer = "...";
} }

View File

@ -69,7 +69,7 @@ function xmpp_plugin_settings(&$a,&$s) {
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
} }
if (!get_config("xmpp", "central_userbase") OR get_pconfig(local_user(),"xmpp","individual")) { if (!get_config("xmpp", "central_userbase") || get_pconfig(local_user(),"xmpp","individual")) {
$s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">'.t('Jabber BOSH host').'</label>'; $s .= '<label id="xmpp-bosh-proxy-label" for="xmpp-bosh-proxy">'.t('Jabber BOSH host').'</label>';
$s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="'.$bosh_proxy.'" />'; $s .= ' <input id="xmpp-bosh-proxy" type="text" name="xmpp_bosh_proxy" value="'.$bosh_proxy.'" />';
$s .= '<div class="clear"></div>'; $s .= '<div class="clear"></div>';
@ -131,7 +131,7 @@ function xmpp_converse(&$a,&$s) {
$a->page['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />'."\n"; $a->page['htmlhead'] .= '<link type="text/css" rel="stylesheet" media="screen" href="addon/xmpp/converse/css/converse.css" />'."\n";
$a->page['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>'."\n"; $a->page['htmlhead'] .= '<script src="addon/xmpp/converse/builds/converse.min.js"></script>'."\n";
if (get_config("xmpp", "central_userbase") AND !get_pconfig(local_user(),"xmpp","individual")) { if (get_config("xmpp", "central_userbase") && !get_pconfig(local_user(),"xmpp","individual")) {
$bosh_proxy = get_config("xmpp", "bosh_proxy"); $bosh_proxy = get_config("xmpp", "bosh_proxy");
$password = get_pconfig(local_user(), "xmpp", "password"); $password = get_pconfig(local_user(), "xmpp", "password");