From: Hypolite Petovan Date: Fri, 9 Jun 2017 01:20:27 +0000 (-0400) Subject: Replace and/AND and or/OR by && and || X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=8fa3f2415a3f3906f5fdadd1601ec6830ecce3c9;p=friendica-addons.git Replace and/AND and or/OR by && and || --- diff --git a/appnet/appnet.php b/appnet/appnet.php index 042b2f8c..fff1cc73 100644 --- a/appnet/appnet.php +++ b/appnet/appnet.php @@ -107,7 +107,7 @@ function appnet_connect(&$a) { $clientId = get_config('appnet','clientid'); $clientSecret = get_config('appnet','clientsecret'); - if (($clientId == "") OR ($clientSecret == "")) { + if (($clientId == "") || ($clientSecret == "")) { $clientId = get_pconfig(local_user(),'appnet','clientid'); $clientSecret = get_pconfig(local_user(),'appnet','clientsecret'); } @@ -154,7 +154,7 @@ function appnet_settings(&$a,&$s) { $app_clientId = get_config('appnet','clientid'); $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_clientSecret = get_pconfig(local_user(),'appnet','clientsecret'); } @@ -213,7 +213,7 @@ function appnet_settings(&$a,&$s) { $s .= t("

Error fetching user profile. Please clear the configuration and try again.

"); } - } elseif (($app_clientId == '') OR ($app_clientSecret == '')) { + } elseif (($app_clientId == '') || ($app_clientSecret == '')) { $s .= t("

You have two ways to connect to App.net.

"); $s .= "
"; $s .= t('

First way: Register an application at https://account.app.net/developer/apps/ and enter Client ID and Client Secret. '); @@ -245,7 +245,7 @@ function appnet_settings(&$a,&$s) { $s .= ''.t("Sign in using App.net").''; } - if (($app_clientId != '') OR ($app_clientSecret != '') OR ($token !='')) { + if (($app_clientId != '') || ($app_clientSecret != '') || ($token !='')) { $s .= '

'; $s .= ''; @@ -278,7 +278,7 @@ function appnet_settings_post(&$a,&$b) { if (isset($_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', 'post', intval($_POST['appnet'])); @@ -375,12 +375,12 @@ function appnet_create_entities($a, $b, $postdata) { $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); $max = 256 - strlen($postdata["title"]); $text = shortenmsg($text, $max); $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"]); $max = 240; $text = shortenmsg($text, $max); @@ -421,7 +421,7 @@ function appnet_send(&$a,&$b) { logger("appnet_send: parameter ".print_r($b, true), LOGGER_DATA); // 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"]); return; } @@ -443,18 +443,18 @@ function appnet_send(&$a,&$b) { $nicknameplain = "@".$nicknameplain; 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"]; logger("appnet_send: parent found ".print_r($orig_post, true), LOGGER_DATA); } else { $iscomment = false; - if($b['private'] OR !strstr($b['postopts'],'appnet')) + if($b['private'] || !strstr($b['postopts'],'appnet')) 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"); if($b['verb'] == ACTIVITY_LIKE) { @@ -542,7 +542,7 @@ function appnet_send(&$a,&$b) { "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://", "https://"), array("", ""), $display_url); @@ -725,7 +725,7 @@ function appnet_fetchstream($a, $uid) { $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` INNER JOIN `item` ON `thread`.`iid` = `item`.`parent` AND `thread`.`uid` = `item`.`uid` WHERE `item`.`id` = %d AND `thread`.`mention` LIMIT 1", dbesc($item)); @@ -788,7 +788,7 @@ function appnet_fetchstream($a, $uid) { $parent_id = 0; 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); } else { @@ -797,7 +797,7 @@ function appnet_fetchstream($a, $uid) { } // 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", dbesc($postarray['uri']), intval($uid) @@ -811,8 +811,8 @@ function appnet_fetchstream($a, $uid) { $lastid = $post["id"]; - //if (($item != 0) AND ($postarray['contact-id'] != $me["id"])) { - if (($item != 0) AND !function_exists("check_item_notification")) { + //if (($item != 0) && ($postarray['contact-id'] != $me["id"])) { + if (($item != 0) && !function_exists("check_item_notification")) { require_once('include/enotify.php'); notification(array( 'type' => NOTIFY_TAGSELF, @@ -886,7 +886,7 @@ function appnet_createpost($a, $uid, $post, $me, $user, $ownid, $createuser, $th 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"]; // 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; } - 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-link'] = $post["user"]["canonical_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"])) { $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]"; elseif ($photo["url"] != "") $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) != "") { $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; } } @@ -1075,7 +1075,7 @@ function appnet_expand_entities($a, $body, $entities) { foreach ($entities["links"] AS $links) { $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); else $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) { $photo = array("url" => "", "large" => ""); foreach ($annotations AS $annotation) { - if (($annotation[type] == "net.app.core.oembed") AND + if (($annotation[type] == "net.app.core.oembed") && ($annotation["value"]["type"] == "photo")) { if ($annotation["value"]["url"] != "") $photo["url"] = $annotation["value"]["url"]; @@ -1108,7 +1108,7 @@ function appnet_expand_annotations($a, $annotations) { if ($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]"; //elseif ($annotation["value"]["url"] != "") // $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", intval($uid), dbesc("adn::".$contact["id"])); - if(!count($r) AND !$create_user) + if(!count($r) && !$create_user) return($me["id"]); if ($contact["canonical_url"] == "") 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); return(-1); } @@ -1278,7 +1278,7 @@ function appnet_prepare_body(&$a,&$b) { $nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]"; $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"]; } diff --git a/buffer/buffer.php b/buffer/buffer.php index 89000c1f..0b92144b 100644 --- a/buffer/buffer.php +++ b/buffer/buffer.php @@ -339,14 +339,14 @@ function buffer_send(&$a,&$b) { // Seems like a bug to me // Buffer doesn't add links to Twitter and App.net (but pictures) - //if ($includedlinks AND isset($post["url"])) - if (($profile->service == "twitter") AND isset($post["url"]) AND ($post["type"] != "photo")) + //if ($includedlinks && isset($post["url"])) + if (($profile->service == "twitter") && isset($post["url"]) && ($post["type"] != "photo")) $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["text"] = shortenmsg($post["text"], $limit - (24 + strlen($post["title"]))); $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"]; elseif ($profile->service == "google") $post["text"] .= html_entity_decode(" ", 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"])) $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"]; if (isset($post["image"])) { diff --git a/buffer/bufferapp.php b/buffer/bufferapp.php index 31250336..7215175d 100644 --- a/buffer/bufferapp.php +++ b/buffer/bufferapp.php @@ -85,7 +85,7 @@ if ($callback_url) $this->set_callback_url($callback_url); 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->create_access_token_url(); } diff --git a/diaspora/diaspora.php b/diaspora/diaspora.php index aed80b88..09d8f114 100755 --- a/diaspora/diaspora.php +++ b/diaspora/diaspora.php @@ -142,7 +142,7 @@ function diaspora_settings(&$a,&$s) { $aspects = false; - if ($handle AND $password) { + if ($handle && $password) { $conn = new Diaspora_Connection($handle, $password); $conn->logIn(); $aspects = $conn->getAspects(); diff --git a/facebook/facebook.php b/facebook/facebook.php index 66f52af3..f2e965c4 100644 --- a/facebook/facebook.php +++ b/facebook/facebook.php @@ -13,15 +13,15 @@ * Detailed instructions how to use this plugin can be found at * https://github.com/friendica/friendica/wiki/How-to:-Friendica%E2%80%99s-Facebook-connector * - * Vidoes and embeds will not be posted if there is no other content. Links - * and images will be converted to a format suitable for the Facebook API and - * long posts truncated - with a link to view the full post. + * Vidoes and embeds will not be posted if there is no other content. Links + * and images will be converted to a format suitable for the Facebook API and + * long posts truncated - with a link to view the full post. * * Facebook contacts will not be able to view private photos, as they are not able to - * authenticate to your site to establish identity. We will address this + * authenticate to your site to establish identity. We will address this * in a future release. */ - + /** TODO * - Implement a method for the administrator to delete all configuration data the plugin has created, * e.g. the app_access_token @@ -260,7 +260,7 @@ function fb_get_friends_sync_parsecontact($uid, $contact) { $contact->link = 'http://facebook.com/profile.php?id=' . $contact->id; // 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; // check if we already have a contact @@ -495,9 +495,9 @@ function facebook_post(&$a) { } info( t('Settings updated.') . EOL); - } + } - return; + return; } // Facebook settings form @@ -534,7 +534,7 @@ function facebook_content(&$a) { $fb_limited = get_config('facebook','restrict'); $o = ''; - + $fb_installed = false; if (get_pconfig(local_user(),'facebook','post')) { $access_token = get_pconfig(local_user(),'facebook','access_token'); @@ -546,7 +546,7 @@ function facebook_content(&$a) { } } } - + $appid = get_config('facebook','appid'); if(! $appid) { @@ -559,10 +559,10 @@ function facebook_content(&$a) { $o .= '

' . t('Facebook Connect') . '

'; - if(! $fb_installed) { + if(! $fb_installed) { $o .= ''; } @@ -574,10 +574,10 @@ function facebook_content(&$a) { $o .= ''; - + $o .= '
'; $o .= '
'; $post_by_default = get_pconfig(local_user(),'facebook','post_by_default'); @@ -633,14 +633,14 @@ function facebook_content(&$a) { function facebook_cron($a,$b) { $last = get_config('facebook','last_poll'); - + $poll_interval = intval(get_config('facebook','poll_interval')); if(! $poll_interval) $poll_interval = FACEBOOK_DEFAULT_POLL_INTERVAL; if($last) { $next = $last + ($poll_interval * 60); - if($next > time()) + if($next > time()) return; } @@ -649,7 +649,7 @@ function facebook_cron($a,$b) { // Find the FB users on this site and randomize in case one of them // uses an obscene amount of memory. It may kill this queue run - // but hopefully we'll get a few others through on each run. + // but hopefully we'll get a few others through on each run. $r = q("SELECT * FROM `pconfig` WHERE `cat` = 'facebook' AND `k` = 'post' AND `v` = '1' ORDER BY RAND() "); if(count($r)) { @@ -668,7 +668,7 @@ function facebook_cron($a,$b) { // check for new friends once a day $last_friend_check = get_pconfig($rr['uid'],'facebook','friend_check'); - if($last_friend_check) + if($last_friend_check) $next_friend_check = $last_friend_check + 86400; else $next_friend_check = 0; @@ -679,14 +679,14 @@ function facebook_cron($a,$b) { fb_consume_all($rr['uid']); } } - + if (get_config('facebook', 'realtime_active') == 1) { if (!facebook_check_realtime_active()) { - + logger('facebook_cron: Facebook is not sending Real-Time Updates any more, although it is supposed to. Trying to fix it...', LOGGER_NORMAL); facebook_subscription_add_users(); - - if (facebook_check_realtime_active()) + + if (facebook_check_realtime_active()) logger('facebook_cron: Successful', LOGGER_NORMAL); else { logger('facebook_cron: Failed', LOGGER_NORMAL); @@ -705,7 +705,7 @@ function facebook_cron($a,$b) { . 'Content-type: text/plain; charset=UTF-8' . "\n" . 'Content-transfer-encoding: 8bit' ); - + set_config('facebook', 'realtime_err_mailsent', 1); } } @@ -714,7 +714,7 @@ function facebook_cron($a,$b) { del_config('facebook', 'realtime_first_err'); } } - + set_config('facebook','last_poll', time()); } @@ -770,10 +770,10 @@ function facebook_plugin_admin(&$a, &$o){ $o .= '
'; $o .= '
'; $o .= ''; - + if ($working_connection) { $o .= '

' . t('Real-Time Updates') . '

'; - + $activated = facebook_check_realtime_active(); if ($activated) { $o .= t('Real-Time Updates are activated.') . '

'; @@ -790,7 +790,7 @@ function facebook_plugin_admin(&$a, &$o){ function facebook_plugin_admin_post(&$a){ check_form_security_token_redirectOnErr('/admin/plugins/facebook', 'fbsave'); - + if (x($_REQUEST,'fb_save_keys')) { set_config('facebook', 'appid', $_REQUEST['appid']); set_config('facebook', 'appsecret', $_REQUEST['appsecret']); @@ -821,8 +821,8 @@ function facebook_jot_nets(&$a,&$b) { if(intval($fb_post) == 1) { $fb_defpost = get_pconfig(local_user(),'facebook','post_by_default'); $selected = ((intval($fb_defpost) == 1) ? ' checked="checked" ' : ''); - $b .= '
' - . t('Post to Facebook') . '
'; + $b .= '
' + . t('Post to Facebook') . '
'; } } @@ -877,10 +877,10 @@ function facebook_post_hook(&$a,&$b) { return; // only accept comments from the item owner. Other contacts are unknown to FB. - + if(! link_compare($b['author-link'], $a->get_baseurl() . '/profile/' . $u[0]['nickname'])) return; - + logger('facebook reply id=' . $reply); } @@ -898,7 +898,7 @@ function facebook_post_hook(&$a,&$b) { $allow_str = dbesc(implode(', ',$recipients)); if($allow_str) { - $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'"); + $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $allow_str ) AND `network` = 'face'"); if(count($r)) foreach($r as $rr) $allow_arr[] = $rr['notify']; @@ -906,7 +906,7 @@ function facebook_post_hook(&$a,&$b) { $deny_str = dbesc(implode(', ',$deny)); if($deny_str) { - $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'"); + $r = q("SELECT `notify` FROM `contact` WHERE `id` IN ( $deny_str ) AND `network` = 'face'"); if(count($r)) foreach($r as $rr) $deny_arr[] = $rr['notify']; @@ -916,8 +916,8 @@ function facebook_post_hook(&$a,&$b) { // One or more FB folks were denied access but nobody on FB was specifically allowed access. // This might cause the post to be open to public on Facebook, but only to selected members - // on another network. Since this could potentially leak a post to somebody who was denied, - // we will skip posting it to Facebook with a slightly vague but relevant message that will + // on another network. Since this could potentially leak a post to somebody who was denied, + // we will skip posting it to Facebook with a slightly vague but relevant message that will // hopefully lead somebody to this code comment for a better explanation of what went wrong. notice( t('Post to Facebook cancelled because of multi-network access permission conflict.') . EOL); @@ -932,7 +932,7 @@ function facebook_post_hook(&$a,&$b) { } if($b['verb'] == ACTIVITY_LIKE) - $likes = true; + $likes = true; $appid = get_config('facebook', 'appid' ); @@ -945,9 +945,9 @@ function facebook_post_hook(&$a,&$b) { $fb_token = get_pconfig($b['uid'],'facebook','access_token'); - // post to facebook if it's a public post and we've ticked the 'post to Facebook' box, + // post to facebook if it's a public post and we've ticked the 'post to Facebook' box, // or it's a private message with facebook participants - // or it's a reply or likes action to an existing facebook post + // or it's a reply or likes action to an existing facebook post if($fb_token && ($toplevel || $b['private'] || $reply)) { logger('facebook: able to post'); @@ -979,7 +979,7 @@ function facebook_post_hook(&$a,&$b) { } } - // strip tag links to avoid link clutter, this really should be + // strip tag links to avoid link clutter, this really should be // configurable because we're losing information $msg = preg_replace("/\#\[url=(.*?)\](.*?)\[\/url\]/is",'#$2',$msg); @@ -1145,7 +1145,7 @@ function facebook_post_hook(&$a,&$b) { if($reply) { $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'; if($b['plink']) $postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}'; @@ -1281,7 +1281,7 @@ function fb_queue_hook(&$a,&$b) { logger('facebook_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", intval($x['cid']) ); @@ -1379,7 +1379,7 @@ function fb_consume_all($uid) { $access_token = get_pconfig($uid,'facebook','access_token'); if(! $access_token) return; - + if(! get_pconfig($uid,'facebook','no_wall')) { $private_wall = intval(get_pconfig($uid,'facebook','private_wall')); $s = fetch_url('https://graph.facebook.com/me/feed?access_token=' . $access_token); @@ -1745,7 +1745,7 @@ function fb_consume_stream($uid,$j,$wall = false) { } } } - + if($found_blocked) { logger('facebook: blocking application: ' . $datarray['app']); continue; @@ -1760,19 +1760,19 @@ function fb_consume_stream($uid,$j,$wall = false) { $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]"; elseif (isset($entry->name)) $datarray['body'] .= "\n\n[b]" . $entry->name."[/b]"; 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]"; else $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)) $datarray['body'] .= "\n[url]".$entry->link."[/url]\n"; else @@ -1791,7 +1791,7 @@ function fb_consume_stream($uid,$j,$wall = false) { $datarray['body'] .= "\n[quote]".$quote."[/quote]"; // 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 ($entry->type != "video") { if(isset($entry->picture) && isset($entry->link)) { $datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]'.$entry->picture.'[/img][/url]'; @@ -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) if ($action->name == "View") $datarray['body'] .= " [url=".$action->link."]".$entry->story."[/url]"; @@ -1815,7 +1815,7 @@ function fb_consume_stream($uid,$j,$wall = false) { // $datarray['body'] = $entry->story; // 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; if(trim($datarray['body']) == '') { @@ -1830,17 +1830,17 @@ function fb_consume_stream($uid,$j,$wall = false) { if (isset($entry->actions)) 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]   "; $datarray['body'] = trim($datarray['body']); - //if(($datarray['body'] != '') and ($uid == 1)) + //if(($datarray['body'] != '') && ($uid == 1)) // $datarray['body'] .= "[noparse]".print_r($entry, true)."[/noparse]"; if (isset($entry->place)) { - if ($entry->place->name or $entry->place->location->street or - $entry->place->location->city or $entry->place->location->Denmark) { + if ($entry->place->name || $entry->place->location->street || + $entry->place->location->city || $entry->place->location->Denmark) { $datarray['coord'] = ''; if ($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; if ($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) .' '.substr($entry->place->location->longitude, 0, 8); } @@ -1931,28 +1931,28 @@ function fb_consume_stream($uid,$j,$wall = false) { * @return bool|string */ function fb_get_app_access_token() { - + $acc_token = get_config('facebook','app_access_token'); - + if ($acc_token !== false) return $acc_token; - + $appid = get_config('facebook','appid'); $appsecret = get_config('facebook', 'appsecret'); - + if ($appid === false || $appsecret === false) { logger('fb_get_app_access_token: appid and/or appsecret not set', LOGGER_DEBUG); return false; } logger('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $appsecret . '&grant_type=client_credentials', LOGGER_DATA); $x = fetch_url('https://graph.facebook.com/oauth/access_token?client_id=' . $appid . '&client_secret=' . $appsecret . '&grant_type=client_credentials'); - + if(strpos($x,'access_token=') !== false) { logger('fb_get_app_access_token: returned access token: ' . $x, LOGGER_DATA); - + $token = str_replace('access_token=', '', $x); if(strpos($token,'&') !== false) $token = substr($token,0,strpos($token,'&')); - + if ($token == "") { logger('fb_get_app_access_token: empty token: ' . $x, LOGGER_DEBUG); return false; @@ -1968,10 +1968,10 @@ function fb_get_app_access_token() { function facebook_subscription_del_users() { $a = get_app(); $access_token = fb_get_app_access_token(); - + $url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token; facebook_delete_url($url); - + if (!facebook_check_realtime_active()) del_config('facebook', 'realtime_active'); } @@ -1981,15 +1981,15 @@ function facebook_subscription_del_users() { function facebook_subscription_add_users($second_try = false) { $a = get_app(); $access_token = fb_get_app_access_token(); - + $url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token; - + list($usec, $sec) = explode(" ", microtime()); $verify_token = sha1($usec . $sec . rand(0, 999999999)); set_config('facebook', 'cb_verify_token', $verify_token); - + $cb = $a->get_baseurl() . '/facebook/?realtime_cb=1'; - + $j = post_url($url,array( "object" => "user", "fields" => "feed,friends", @@ -1997,7 +1997,7 @@ function facebook_subscription_add_users($second_try = false) { "verify_token" => $verify_token, )); del_config('facebook', 'cb_verify_token'); - + if ($j) { $x = json_decode($j); logger("Facebook reponse: " . $j, LOGGER_DATA); @@ -2018,10 +2018,10 @@ function facebook_subscription_add_users($second_try = false) { * @return null|array */ function facebook_subscriptions_get() { - + $access_token = fb_get_app_access_token(); if (!$access_token) return null; - + $url = "https://graph.facebook.com/" . get_config('facebook', 'appid' ) . "/subscriptions?access_token=" . $access_token; $j = fetch_url($url); $ret = null; @@ -2059,7 +2059,7 @@ if(! function_exists('facebook_delete_url')) { function facebook_delete_url($url,$headers = null, &$redirects = 0, $timeout = 0) { $a = get_app(); $ch = curl_init($url); - if(($redirects > 8) || (! $ch)) + if(($redirects > 8) || (! $ch)) return false; curl_setopt($ch, CURLOPT_HEADER, true); diff --git a/fbpost/fbpost.php b/fbpost/fbpost.php index 72373ff9..3e6e6e0e 100644 --- a/fbpost/fbpost.php +++ b/fbpost/fbpost.php @@ -412,7 +412,7 @@ function fbpost_jot_nets(&$a,&$b) { if(intval($fb_post) == 1) { $fb_defpost = get_pconfig(local_user(),'facebook','post_by_default'); $selected = ((intval($fb_defpost) == 1) ? ' checked="checked" ' : ''); - $b .= '
' + $b .= '
' . t('Post to Facebook') . '
'; } } @@ -435,7 +435,7 @@ function fbpost_post_hook(&$a,&$b) { if($b['extid'] == NETWORK_FACEBOOK) return; - if(($b['app'] == "Facebook") AND ($b['verb'] != ACTIVITY_LIKE)) + if(($b['app'] == "Facebook") && ($b['verb'] != ACTIVITY_LIKE)) return; 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 if(count($r) && substr($r[0]['uri'],0,4) === 'fb::') $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); else return; @@ -525,8 +525,8 @@ function fbpost_post_hook(&$a,&$b) { // One or more FB folks were denied access but nobody on FB was specifically allowed access. // This might cause the post to be open to public on Facebook, but only to selected members - // on another network. Since this could potentially leak a post to somebody who was denied, - // we will skip posting it to Facebook with a slightly vague but relevant message that will + // on another network. Since this could potentially leak a post to somebody who was denied, + // we will skip posting it to Facebook with a slightly vague but relevant message that will // hopefully lead somebody to this code comment for a better explanation of what went wrong. notice( t('Post to Facebook cancelled because of multi-network access permission conflict.') . EOL); @@ -647,14 +647,14 @@ function fbpost_post_hook(&$a,&$b) { $post_to_page = get_pconfig($b['uid'],'facebook','post_to_page'); $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; else $target = "me"; if($reply) { $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 ($video != "") $link = $video; @@ -667,7 +667,7 @@ function fbpost_post_hook(&$a,&$b) { $postvars['message'] = $msg; $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 $postvars = array( 'access_token' => $fb_token, @@ -677,10 +677,10 @@ function fbpost_post_hook(&$a,&$b) { $postvars['message'] = $msg; $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 { $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'] . '"}'; } /* } else { @@ -694,7 +694,7 @@ function fbpost_post_hook(&$a,&$b) { } */ // 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; 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 // 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'])); if (count($r)) $a->contact = $r[0]["id"]; @@ -830,7 +830,7 @@ function fbpost_queue_hook(&$a,&$b) { logger('fbpost_queue_hook: 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", intval($x['cid']) ); @@ -873,7 +873,7 @@ function fbpost_queue_hook(&$a,&$b) { // If it is a special kind of failure the post was receiced // Although facebook said it wasn't received ... $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']); else logger('fbpost_queue_hook: Not requeued, since it seems to be received'); @@ -980,7 +980,7 @@ function fbpost_cleanpicture($url) { $urldata = parse_url($url); if (isset($urldata["query"])) { 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($url); @@ -1036,10 +1036,10 @@ function fbpost_fetchwall($a, $uid) { elseif(!isset($item->privacy)) 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; - 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; $_SESSION["authenticated"] = true; @@ -1061,7 +1061,7 @@ function fbpost_fetchwall($a, $uid) { $content = ""; $pagedata["type"] = ""; - if(isset($item->name) and isset($item->link)) { + if(isset($item->name) && isset($item->link)) { $item->link = original_url($item->link); $oembed_data = oembed_fetch_url($item->link); $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. $removedlink = trim(str_replace($item->link, "", $_REQUEST["body"])); - if (($removedlink == "") OR strstr($_REQUEST["body"], $removedlink)) + if (($removedlink == "") || strstr($_REQUEST["body"], $removedlink)) $_REQUEST["body"] = $removedlink; } elseif (isset($item->name)) $content .= "[b]".$item->name."[/b]"; $pagedata["text"] = ""; - if(isset($item->description) and ($item->type != "photo")) + if(isset($item->description) && ($item->type != "photo")) $pagedata["text"] = $item->description; - if(isset($item->caption) and ($item->type == "photo")) + if(isset($item->caption) && ($item->type == "photo")) $pagedata["text"] = $item->caption; // Only import the picture when the message is no video // oembed display a picture of the video as well //if ($item->type != "video") { - //if (($item->type != "video") and ($item->type != "photo")) { - if (($pagedata["type"] == "") OR ($pagedata["type"] == "link")) { + //if (($item->type != "video") && ($item->type != "photo")) { + if (($pagedata["type"] == "") || ($pagedata["type"] == "link")) { $pagedata["type"] = $item->type; if (isset($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); $url = "https://graph.facebook.com/".$item->object_id."?access_token=".$access_token; $feed = fetch_url($url); @@ -1151,8 +1151,8 @@ function fbpost_fetchwall($a, $uid) { } if (isset($item->place)) { - if ($item->place->name or $item->place->location->street or - $item->place->location->city or $item->place->location->country) { + if ($item->place->name || $item->place->location->street || + $item->place->location->city || $item->place->location->country) { $_REQUEST["location"] = ''; if ($item->place->name) $_REQUEST["location"] .= $item->place->name; @@ -1165,7 +1165,7 @@ function fbpost_fetchwall($a, $uid) { $_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) .' '.substr($item->place->location->longitude, 0, 8); } @@ -1210,7 +1210,7 @@ function fbpost_get_photo($uid,$link) { 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"; $queryvar = fbpost_parse_query($image); diff --git a/fbsync/fbsync.php b/fbsync/fbsync.php index 5a429ad8..07f6dcf1 100644 --- a/fbsync/fbsync.php +++ b/fbsync/fbsync.php @@ -42,7 +42,7 @@ function fbsync_follow($a, &$contact) { 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; // 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; - 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, "_"); if ($pos != 0) { @@ -279,7 +279,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $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-link'] = $userdata["link"]; $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 $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); // 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) { logger('fbsync_createpost: Contact is blocked. Post not imported '.print_r($post, true), LOGGER_DEBUG); 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); return; } elseif ($contact_id == 0) { @@ -357,7 +357,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $content = ""; $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); $oembed_data = oembed_fetch_url($post->attachment->href); $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. $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; - } elseif (isset($post->attachment->name) AND ($post->attachment->name != "")) + } elseif (isset($post->attachment->name) && ($post->attachment->name != "")) $content = "[b]" . $post->attachment->name."[/b]"; $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; - 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; if ($pagedata["text"].$post->attachment->href.$content.$postarray["body"] == "") 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) { if (isset($media->type)) @@ -397,7 +397,7 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr $pagedata["images"][0]["src"] = $media->src; 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; 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"]); - 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); $pagedata["url"] = $media->href; $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 - 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); return; } @@ -640,7 +640,7 @@ function fbsync_createcomment($a, $uid, $self_id, $self, $user, $contacts, $appl foreach($myconv as $conv) { // 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; 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", intval($uid), dbesc("facebook::".$contact->id)); - if(!count($r) AND !$create_user) + if(!count($r) && !$create_user) 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); return(-1); } @@ -970,7 +970,7 @@ function fbsync_fetchuser($a, $uid, $id) { intval($uid), dbesc("facebook::".$id)); 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); $user["contact-id"] = -1; } else diff --git a/fromgplus/fromgplus.php b/fromgplus/fromgplus.php index f4a61ec2..097bac18 100644 --- a/fromgplus/fromgplus.php +++ b/fromgplus/fromgplus.php @@ -63,7 +63,7 @@ function fromgplus_addon_settings(&$a,&$s) { $s .= ''; $s .= '
'; - $s .= '
'; $s .= '
'; @@ -178,7 +178,7 @@ function fromgplus_post($a, $uid, $source, $body, $location, $coord, $id) { $_REQUEST['location'] = $location; $_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)); return; } @@ -269,13 +269,13 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) { else $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"]; $cleaned["full"] = $cleaned["preview"]; $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"] = ""; if ($cleaned["full"] == "") @@ -338,7 +338,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { // Add Keywords to page link $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"]; } break; @@ -366,7 +366,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) { $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"; $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName); } @@ -491,7 +491,7 @@ function fromgplus_fetch($a, $uid) { if (isset($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)) $coord = $item->location->position->latitude." ".$item->location->position->longitude; @@ -542,7 +542,7 @@ function fromgplus_fetch($a, $uid) { if (isset($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)) $coord = $item->location->position->latitude." ".$item->location->position->longitude; diff --git a/geocoordinates/geocoordinates.php b/geocoordinates/geocoordinates.php index ff726425..34f850cb 100644 --- a/geocoordinates/geocoordinates.php +++ b/geocoordinates/geocoordinates.php @@ -57,7 +57,7 @@ function geocoordinates_resolve_item(&$item) { 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); return; } diff --git a/gpluspost/gpluspost.php b/gpluspost/gpluspost.php index a3ed1f9c..c8918e1c 100644 --- a/gpluspost/gpluspost.php +++ b/gpluspost/gpluspost.php @@ -98,7 +98,7 @@ function gpluspost_settings(&$a,&$s) { if (gpluspost_nextscripts()) { /* // To-Do: Option to check the credentials if requested - if (($username != "") AND ($password != "")) { + if (($username != "") && ($password != "")) { require_once("addon/gpluspost/postToGooglePlus.php"); $loginError = doConnectToGooglePlus2($username, $password); if ($loginError) @@ -231,7 +231,7 @@ function gpluspost_send(&$a,&$b) { return; // 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; if (!gpluspost_nextscripts()) { @@ -331,7 +331,7 @@ function gpluspost_queue_hook(&$a,&$b) { logger('gpluspost_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", intval($x['cid']) ); @@ -527,7 +527,7 @@ function gpluspost_feeditem($pid, $uid) { else if ($image != "") $msglink = $image; - if (($msglink == "") AND $skipwithoutlink) + if (($msglink == "") && $skipwithoutlink) continue; else if ($msglink == "") $msglink = $item["plink"]; diff --git a/ifttt/ifttt.php b/ifttt/ifttt.php index 35f3ccc6..e5428e82 100644 --- a/ifttt/ifttt.php +++ b/ifttt/ifttt.php @@ -132,7 +132,7 @@ function ifttt_post(&$a) { if (isset($_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); ifttt_message($uid, $item); @@ -164,17 +164,16 @@ function ifttt_message($uid, $item) { if ($item["type"] == "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"]; - if (isset($item["description"]) AND (trim($item["description"]) != "")) + if (isset($item["description"]) && (trim($item["description"]) != "")) $data["text"] = $item["description"]; $_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"; //print_r($_REQUEST); item_post($a); } -?> diff --git a/jappixmini/jappixmini.php b/jappixmini/jappixmini.php index 44b69a4e..370d2c7b 100644 --- a/jappixmini/jappixmini.php +++ b/jappixmini/jappixmini.php @@ -269,7 +269,7 @@ function jappixmini_settings(&$a, &$s) { if ($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"]; $info_text = get_config("jappixmini", "infotext"); @@ -444,7 +444,7 @@ function jappixmini_script(&$a,&$s) { $activate = get_pconfig(local_user(),'jappixmini','activate'); $dontinsertchat = get_pconfig(local_user(), 'jappixmini','dontinsertchat'); - if (!$activate or $dontinsertchat) return; + if (!$activate || $dontinsertchat) return; $a->page['htmlhead'] .= ''."\r\n"; $a->page['htmlhead'] .= ''."\r\n"; diff --git a/leistungsschutzrecht/leistungsschutzrecht.php b/leistungsschutzrecht/leistungsschutzrecht.php index 39eb4db1..60ca9b8b 100644 --- a/leistungsschutzrecht/leistungsschutzrecht.php +++ b/leistungsschutzrecht/leistungsschutzrecht.php @@ -86,7 +86,7 @@ function leistungsschutzrecht_fetchsites() { if (isset($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"]); $hostname = explode(".", $cleanedurlpart[0]); diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index fb7ce8c1..1153000d 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -122,7 +122,7 @@ function pumpio_connect(&$a) { $consumer_secret = get_pconfig(local_user(), 'pumpio','consumer_secret'); $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"); $clientdata = pumpio_registerclient($a, $hostname); 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); } - 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)); $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 .= ''; $s .= '
'; - if (($username != '') AND ($servername != '')) { + if (($username != '') && ($servername != '')) { $oauth_token = get_pconfig(local_user(), "pumpio", "oauth_token"); $oauth_token_secret = get_pconfig(local_user(), "pumpio", "oauth_token_secret"); $s .= '
'; - if (($oauth_token == "") OR ($oauth_token_secret == "")) { + if (($oauth_token == "") || ($oauth_token_secret == "")) { $s .= '
'; @@ -403,7 +403,7 @@ function pumpio_send(&$a,&$b) { 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; } @@ -418,10 +418,10 @@ function pumpio_send(&$a,&$b) { if($b['verb'] == ACTIVITY_DISLIKE) 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"]); - if (($b['verb'] == ACTIVITY_POST) AND $b['deleted']) + if (($b['verb'] == ACTIVITY_POST) && $b['deleted']) pumpio_action($a, $b["uid"], $b["uri"], "delete"); if($b['deleted'] || ($b['created'] !== $b['edited'])) @@ -480,7 +480,7 @@ function pumpio_send(&$a,&$b) { $inReplyTo = array("id" => $orig_post["uri"], "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"]); $params["object"] = array( @@ -516,7 +516,7 @@ function pumpio_send(&$a,&$b) { $post_id = $user->object->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']); q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", dbesc($post_id), @@ -562,12 +562,12 @@ function pumpio_action(&$a, $uid, $uri, $action, $content = "") { $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"]; else $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"]); elseif (strstr($uri, "/api/comment/")) $objectType = "comment"; @@ -763,7 +763,7 @@ function pumpio_fetchtimeline(&$a, $uid) { if ($receiver->id == "http://activityschema.org/collection/public") $public = true; - if ($public AND !stristr($post->generator->displayName, $application_name)) { + if ($public && !stristr($post->generator->displayName, $application_name)) { require_once('include/html2bbcode.php'); $_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/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); - if (($post->verb == "unlike") OR ($post->verb == "unfavorite")) + if (($post->verb == "unlike") || ($post->verb == "unfavorite")) return pumpio_dounlike($a, $uid, $self, $post, $own_id); if ($post->verb == "delete") @@ -1206,9 +1206,9 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet if ($post->verb == "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; - 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; else $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); $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", dbesc($postarray["title"]), dbesc($postarray["body"]), @@ -1278,7 +1278,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet foreach($myconv as $conv) { // 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; require_once('include/enotify.php'); @@ -1427,7 +1427,7 @@ function pumpio_queue_hook(&$a,&$b) { 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", intval($x['cid']) ); @@ -1448,8 +1448,8 @@ function pumpio_queue_hook(&$a,&$b) { $success = false; - if ($oauth_token AND $oauth_token_secret AND - $consumer_key AND $consumer_secret) { + if ($oauth_token && $oauth_token_secret && + $consumer_key && $consumer_secret) { $username = $user.'@'.$host; logger('pumpio_queue: able to post for user '.$username); @@ -1473,7 +1473,7 @@ function pumpio_queue_hook(&$a,&$b) { if($success) { $post_id = $user->object->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']); q("UPDATE `item` SET `extid` = '%s' WHERE `id` = %d", dbesc($post_id), diff --git a/pumpio/pumpio_sync.php b/pumpio/pumpio_sync.php index e691a387..51efe9c4 100644 --- a/pumpio/pumpio_sync.php +++ b/pumpio/pumpio_sync.php @@ -2,7 +2,7 @@ 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]); if (substr($directory, 0, 1) != "/") diff --git a/rendertime/rendertime.php b/rendertime/rendertime.php index d666c6a8..034fdec7 100755 --- a/rendertime/rendertime.php +++ b/rendertime/rendertime.php @@ -29,7 +29,7 @@ function rendertime_page_end(&$a, &$o) { $ignored_modules = array("fbrowser"); $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.'
'.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_write"], 3), diff --git a/statistics_json/statistics_json.php b/statistics_json/statistics_json.php index 87ffdb00..2bd2f41f 100644 --- a/statistics_json/statistics_json.php +++ b/statistics_json/statistics_json.php @@ -110,11 +110,11 @@ function statistics_json_cron($a,$b) { $month = time() - (30 * 24 * 60 * 60); foreach ($users AS $user) { - if ((strtotime($user['login_date']) > $halfyear) OR + if ((strtotime($user['login_date']) > $halfyear) || (strtotime($user['lastitem_date']) > $halfyear)) ++$active_users_halfyear; - if ((strtotime($user['login_date']) > $month) OR + if ((strtotime($user['login_date']) > $month) || (strtotime($user['lastitem_date']) > $month)) ++$active_users_monthly; diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index 9c44ef02..fd266ef1 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -155,7 +155,7 @@ function statusnet_jot_nets(&$a,&$b) { if(intval($statusnet_post) == 1) { $statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default'); $selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : ''); - $b .= '
' + $b .= '
' . t('Post to GNU Social') . '
'; } } @@ -421,7 +421,7 @@ function statusnet_settings(&$a,&$s) { $s .= ''; $s .= ''; $s .= '
'; - $s .= '
'; + $s .= '
'; } } $s .= '
'; @@ -494,8 +494,8 @@ function statusnet_post_hook(&$a,&$b) { // Looking if its a reply to a GNU Social post $hostlength = strlen($hostname) + 2; - if ((substr($b["parent-uri"], 0, $hostlength) != $hostname."::") AND (substr($b["extid"], 0, $hostlength) != $hostname."::") - AND (substr($b["thr-parent"], 0, $hostlength) != $hostname."::")) { + if ((substr($b["parent-uri"], 0, $hostlength) != $hostname."::") && (substr($b["extid"], 0, $hostlength) != $hostname."::") + && (substr($b["thr-parent"], 0, $hostlength) != $hostname."::")) { logger("statusnet_post_hook: no GNU Social post ".$b["parent"]); return; } @@ -523,18 +523,18 @@ function statusnet_post_hook(&$a,&$b) { $nicknameplain = "@".$nick; 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"]; logger("statusnet_post_hook: parent found ".print_r($orig_post, true), LOGGER_DEBUG); } else { $iscomment = false; - if($b['private'] OR !strstr($b['postopts'],'statusnet')) + if($b['private'] || !strstr($b['postopts'],'statusnet')) 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"); if($b['verb'] == ACTIVITY_LIKE) { @@ -584,18 +584,18 @@ function statusnet_post_hook(&$a,&$b) { $msgarr = plaintext($a, $b, $max_char, true, 7); $msg = $msgarr["text"]; - if (($msg == "") AND isset($msgarr["title"])) + if (($msg == "") && isset($msgarr["title"])) $msg = shortenmsg($msgarr["title"], $max_char - 50); $image = ""; - if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) { - if ((strlen($msgarr["url"]) > 20) AND + if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) { + if ((strlen($msgarr["url"]) > 20) && ((strlen($msg." \n".$msgarr["url"]) > $max_char))) $msg .= " \n".short_link($msgarr["url"]); else $msg .= " \n".$msgarr["url"]; - } elseif (isset($msgarr["image"]) AND ($msgarr["type"] != "video")) + } elseif (isset($msgarr["image"]) && ($msgarr["type"] != "video")) $image = $msgarr["image"]; if ($image != "") { @@ -738,7 +738,7 @@ function statusnet_prepare_body(&$a,&$b) { $nickname = "@[url=".$orig_post["author-link"]."]".$nick."[/url]"; $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"]; } @@ -746,7 +746,7 @@ function statusnet_prepare_body(&$a,&$b) { $msgarr = plaintext($a, $item, $max_char, true, 7); $msg = $msgarr["text"]; - if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) + if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) $msg .= " ".$msgarr["url"]; 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", 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); - 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); 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-avatar'] = $post->user->profile_image_url; } - if(($contactid == 0) AND !$only_existing_contact) + if(($contactid == 0) && !$only_existing_contact) $contactid = $self['id']; elseif ($contactid <= 0) return(array()); @@ -1279,7 +1279,7 @@ function statusnet_checknotification($a, $uid, $own_url, $top_item, $postarray) foreach($myconv as $conv) { // 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; require_once('include/enotify.php'); @@ -1375,11 +1375,11 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) { $items = $connection->get('statuses/home_timeline', $parameters); if (!is_array($items)) { - if (is_object($items) AND isset($items->error)) + if (is_object($items) && isset($items->error)) $errormsg = $items->error; elseif (is_object($items)) $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; else $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); - if ($item AND !function_exists("check_item_notification")) + if ($item && !function_exists("check_item_notification")) 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); - if ($item AND function_exists("check_item_notification")) + if ($item && function_exists("check_item_notification")) check_item_notification($item, $uid, NOTIFY_TAGSELF); } } @@ -1482,7 +1482,7 @@ function statusnet_fetchhometimeline($a, $uid, $mode = 1) { $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'); notification(array( '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); - if ($item AND !function_exists("check_item_notification")) + if ($item && !function_exists("check_item_notification")) 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]"; $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); elseif ($oembed_data->type != "link") $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 != "") $footer = add_page_info($footerurl); - if (($footerlink != "") AND (trim($footer) != "")) { + if (($footerlink != "") && (trim($footer) != "")) { $removedlink = trim(str_replace($footerlink, "", $body)); - if (($removedlink == "") OR strstr($body, $removedlink)) + if (($removedlink == "") || strstr($body, $removedlink)) $body = $removedlink; $body .= $footer; diff --git a/tumblr/tumblr.php b/tumblr/tumblr.php index 619ff16e..5685ed4b 100644 --- a/tumblr/tumblr.php +++ b/tumblr/tumblr.php @@ -143,7 +143,7 @@ function tumblr_callback($a) { // It'll need our Consumer Key and Secret as well as our Request Token and Secret $tum_oauth = new TumblrOAuth($consumer_key, $consumer_secret, $_SESSION['request_token'], $_SESSION['request_token_secret']); - // Ok, let's get an Access Token. We'll need to pass along our oauth_verifier which was given to us in the URL. + // Ok, let's get an Access Token. We'll need to pass along our oauth_verifier which was given to us in the URL. $access_token = $tum_oauth->getAccessToken($_REQUEST['oauth_verifier']); // We're done with the Request Token and Secret so let's remove those. @@ -227,7 +227,7 @@ function tumblr_settings(&$a,&$s) { $oauth_token_secret = get_pconfig(local_user(), "tumblr", "oauth_token_secret"); $s .= '
'; - if (($oauth_token != "") and ($oauth_token_secret != "")) { + if (($oauth_token != "") && ($oauth_token_secret != "")) { $page = get_pconfig(local_user(),'tumblr','page'); $consumer_key = get_config('tumblr','consumer_key'); @@ -350,7 +350,7 @@ function tumblr_send(&$a,&$b) { if (!isset($siteinfo["type"])) $siteinfo["type"] = ""; - if (($title == "") AND isset($siteinfo["title"])) + if (($title == "") && isset($siteinfo["title"])) $title = $siteinfo["title"]; if (isset($siteinfo["text"])) @@ -391,7 +391,7 @@ function tumblr_send(&$a,&$b) { break; } - if (isset($params['caption']) AND (trim($title) != "")) + if (isset($params['caption']) && (trim($title) != "")) $params['caption'] = '

'.$title."

". "

".$params['caption']."

"; diff --git a/twitter/twitter.php b/twitter/twitter.php index 74245fa2..19577b47 100644 --- a/twitter/twitter.php +++ b/twitter/twitter.php @@ -32,7 +32,7 @@ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * */ - + /* Twitter Plugin for Friendica * * Author: Tobias Diekershoff @@ -118,7 +118,7 @@ function twitter_follow($a, &$contact) { 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; // contact seems to be a twitter contact, so continue @@ -161,7 +161,7 @@ function twitter_jot_nets(&$a,&$b) { if(intval($tw_post) == 1) { $tw_defpost = get_pconfig(local_user(),'twitter','post_by_default'); $selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : ''); - $b .= '
' + $b .= '
' . t('Post to Twitter') . '
'; } } @@ -327,7 +327,7 @@ function twitter_settings(&$a,&$s) { $s .= ''; $s .= ''; $s .= '
'; - $s .= '
'; + $s .= '
'; } } $s .= '
'; @@ -405,7 +405,7 @@ function twitter_post_hook(&$a,&$b) { logger("twitter_post_hook: parameter ".print_r($b, true), LOGGER_DATA); // 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"]); return; } @@ -428,18 +428,18 @@ function twitter_post_hook(&$a,&$b) { $nicknameplain = "@".$nicknameplain; 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"]; logger("twitter_post_hook: parent found ".print_r($orig_post, true), LOGGER_DATA); } else { $iscomment = false; - if($b['private'] OR !strstr($b['postopts'],'twitter')) + if($b['private'] || !strstr($b['postopts'],'twitter')) 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"); if($b['verb'] == ACTIVITY_LIKE) { @@ -487,19 +487,19 @@ function twitter_post_hook(&$a,&$b) { $msgarr = plaintext($a, $b, $max_char, true, 8); $msg = $msgarr["text"]; - if (($msg == "") AND isset($msgarr["title"])) + if (($msg == "") && isset($msgarr["title"])) $msg = shortenmsg($msgarr["title"], $max_char - 50); $image = ""; - if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) + if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) $msg .= "\n".$msgarr["url"]; - if (isset($msgarr["image"]) AND ($msgarr["type"] != "video")) + if (isset($msgarr["image"]) && ($msgarr["type"] != "video")) $image = $msgarr["image"]; // and now tweet it :-) - if(strlen($msg) and ($image != "")) { + if(strlen($msg) && ($image != "")) { $img_str = fetch_url($image); $tempfile = tempnam(get_temppath(), "cache"); @@ -528,7 +528,7 @@ function twitter_post_hook(&$a,&$b) { if ($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) . '"'); // 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'; $post = array('status' => $msg); @@ -734,7 +734,7 @@ function twitter_prepare_body(&$a,&$b) { $nickname = "@[url=".$orig_post["author-link"]."]".$nicknameplain."[/url]"; $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"]; } @@ -742,7 +742,7 @@ function twitter_prepare_body(&$a,&$b) { $msgarr = plaintext($a, $item, $max_char, true, 8); $msg = $msgarr["text"]; - if (isset($msgarr["url"]) AND ($msgarr["type"] != "photo")) + if (isset($msgarr["url"]) && ($msgarr["type"] != "photo")) $msg .= " ".$msgarr["url"]; if (isset($msgarr["image"])) @@ -875,7 +875,7 @@ function twitter_queue_hook(&$a,&$b) { logger('twitter_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", intval($x['cid']) ); @@ -891,7 +891,7 @@ function twitter_queue_hook(&$a,&$b) { $success = false; - if ($ckey AND $csecret AND $otoken AND $osecret) { + if ($ckey && $csecret && $otoken && $osecret) { 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", intval($uid), dbesc("twitter::".$contact->id_str)); - if(!count($r) AND !$create_user) + if(!count($r) && !$create_user) 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); return(-1); } @@ -1135,14 +1135,14 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) { $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); $oembed_data = oembed_fetch_url($expanded_url); // 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; if ($type == "") @@ -1158,7 +1158,7 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) { $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)) { + } elseif (($oembed_data->type == "photo") && isset($oembed_data->url)) { $body = str_replace($url->url, "[url=".$expanded_url."][img]".$oembed_data->url."[/img][/url]", $body); @@ -1193,18 +1193,18 @@ function twitter_expand_entities($a, $body, $item, $no_tags = false, $picture) { if ($footerurl != "") $footer = add_page_info($footerurl, false, $picture); - if (($footerlink != "") AND (trim($footer) != "")) { + if (($footerlink != "") && (trim($footer) != "")) { $removedlink = trim(str_replace($footerlink, "", $body)); - if (($removedlink == "") OR strstr($body, $removedlink)) + if (($removedlink == "") || strstr($body, $removedlink)) $body = $removedlink; $body .= $footer; } - if (($footer == "") AND ($picture != "")) + if (($footer == "") && ($picture != "")) $body .= "\n\n[img]".$picture."[/img]\n"; - elseif (($footer == "") AND ($picture == "")) + elseif (($footer == "") && ($picture == "")) $body = add_page_info_to_body($body); 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. // 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 = ""; foreach($post->extended_entities->media AS $medium) { if (isset($medium->media_url_https)) { @@ -1311,7 +1311,7 @@ function twitter_media_entities($post, &$postarray) { $bitrate = 0; // We take the video with the highest bitrate 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]"; $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); } - if(($contactid == 0) AND !$only_existing_contact) { + if(($contactid == 0) && !$only_existing_contact) { $contactid = $self['id']; } elseif ($contactid <= 0) { 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; } - 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); $postarray['body'] = $statustext; @@ -1537,7 +1537,7 @@ function twitter_checknotification($a, $uid, $own_id, $top_item, $postarray) { foreach($myconv as $conv) { // 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; 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); - if ($item AND !function_exists("check_item_notification")) + if ($item && !function_exists("check_item_notification")) 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); - if ($item AND !function_exists("check_item_notification")) + if ($item && !function_exists("check_item_notification")) twitter_checknotification($a, $uid, $own_id, $item, $postarray); } @@ -1766,10 +1766,10 @@ function twitter_fetchhometimeline($a, $uid) { $item = item_store($postarray); $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); - if (!isset($postarray["parent"]) OR ($postarray["parent"] == 0)) + if (!isset($postarray["parent"]) || ($postarray["parent"] == 0)) $postarray["parent"] = $item; logger('twitter_fetchhometimeline: User '.$self["nick"].' posted mention timeline item '.$item); @@ -1786,7 +1786,7 @@ function twitter_fetchhometimeline($a, $uid) { } else $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'); notification(array( 'type' => NOTIFY_TAGSELF, diff --git a/twitter/twitter_sync.php b/twitter/twitter_sync.php index 49c41354..fd1915d8 100644 --- a/twitter/twitter_sync.php +++ b/twitter/twitter_sync.php @@ -2,7 +2,7 @@ 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]); if (substr($directory, 0, 1) != "/") diff --git a/wppost/wppost.php b/wppost/wppost.php index 931b6d81..10437a06 100755 --- a/wppost/wppost.php +++ b/wppost/wppost.php @@ -257,7 +257,7 @@ function wppost_send(&$a,&$b) { $title = html2plain(bbcode($title, false, false), 0, true)."\n"; $pos = strpos($title, "\n"); $trailer = ""; - if (($pos == 0) or ($pos > 100)) { + if (($pos == 0) || ($pos > 100)) { $pos = 100; $trailer = "..."; } diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index 753ea0a5..076b7b13 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -69,7 +69,7 @@ function xmpp_plugin_settings(&$a,&$s) { $s .= '
'; } - 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 .= ''; $s .= ' '; $s .= '
'; @@ -131,7 +131,7 @@ function xmpp_converse(&$a,&$s) { $a->page['htmlhead'] .= ''."\n"; $a->page['htmlhead'] .= ''."\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"); $password = get_pconfig(local_user(), "xmpp", "password");