Browse Source

Replace AND and OR in PHP conditions by && and ||

pull/3528/head
Hypolite Petovan 3 years ago
parent
commit
9c0d2c31e8
83 changed files with 596 additions and 596 deletions
  1. +10
    -10
      boot.php
  2. +13
    -13
      include/Contact.php
  3. +6
    -6
      include/Photo.php
  4. +2
    -2
      include/acl_selectors.php
  5. +30
    -30
      include/api.php
  6. +1
    -1
      include/auth.php
  7. +18
    -18
      include/bbcode.php
  8. +5
    -5
      include/cache.php
  9. +1
    -1
      include/contact_selectors.php
  10. +1
    -1
      include/contact_widgets.php
  11. +3
    -3
      include/conversation.php
  12. +3
    -3
      include/cron.php
  13. +2
    -2
      include/cronhooks.php
  14. +11
    -11
      include/dba.php
  15. +2
    -2
      include/dba_pdo.php
  16. +2
    -2
      include/dbclean.php
  17. +1
    -1
      include/dbm.php
  18. +5
    -5
      include/dbstructure.php
  19. +3
    -3
      include/delivery.php
  20. +18
    -18
      include/dfrn.php
  21. +30
    -30
      include/diaspora.php
  22. +5
    -5
      include/discover_poco.php
  23. +6
    -6
      include/enotify.php
  24. +2
    -2
      include/follow.php
  25. +1
    -1
      include/gprobe.php
  26. +2
    -2
      include/group.php
  27. +1
    -1
      include/html2plain.php
  28. +6
    -6
      include/identity.php
  29. +29
    -29
      include/items.php
  30. +1
    -1
      include/nav.php
  31. +7
    -7
      include/network.php
  32. +5
    -5
      include/notifier.php
  33. +2
    -2
      include/oembed.php
  34. +2
    -2
      include/onepoll.php
  35. +39
    -39
      include/ostatus.php
  36. +1
    -1
      include/photos.php
  37. +1
    -1
      include/pidfile.php
  38. +15
    -15
      include/plaintext.php
  39. +1
    -1
      include/plugin.php
  40. +6
    -6
      include/poller.php
  41. +3
    -3
      include/post_update.php
  42. +2
    -2
      include/queue.php
  43. +1
    -1
      include/session.php
  44. +54
    -54
      include/socgraph.php
  45. +3
    -3
      include/spool_post.php
  46. +2
    -2
      include/tags.php
  47. +5
    -5
      include/text.php
  48. +4
    -4
      include/threads.php
  49. +4
    -4
      include/update_gcontact.php
  50. +6
    -6
      include/xml.php
  51. +7
    -7
      index.php
  52. +6
    -6
      mod/admin.php
  53. +2
    -2
      mod/community.php
  54. +6
    -6
      mod/contacts.php
  55. +4
    -4
      mod/dfrn_request.php
  56. +2
    -2
      mod/dirfind.php
  57. +4
    -4
      mod/display.php
  58. +1
    -1
      mod/events.php
  59. +1
    -1
      mod/fetch.php
  60. +2
    -2
      mod/follow.php
  61. +13
    -13
      mod/item.php
  62. +2
    -2
      mod/network.php
  63. +8
    -8
      mod/nodeinfo.php
  64. +2
    -2
      mod/noscrape.php
  65. +1
    -1
      mod/photo.php
  66. +6
    -6
      mod/ping.php
  67. +8
    -8
      mod/poco.php
  68. +13
    -13
      mod/proxy.php
  69. +1
    -1
      mod/register.php
  70. +3
    -3
      mod/search.php
  71. +5
    -5
      mod/settings.php
  72. +1
    -1
      mod/update_network.php
  73. +9
    -9
      object/Item.php
  74. +5
    -5
      src/App.php
  75. +2
    -2
      src/Core/Config.php
  76. +2
    -2
      src/Core/PConfig.php
  77. +82
    -82
      src/Network/Probe.php
  78. +5
    -5
      src/Util/Lock.php
  79. +1
    -1
      update.php
  80. +1
    -1
      util/maintenance.php
  81. +2
    -2
      view/theme/frio/php/frio_boot.php
  82. +1
    -1
      view/theme/vier/style.php
  83. +5
    -5
      view/theme/vier/theme.php

+ 10
- 10
boot.php View File

@ -993,7 +993,7 @@ function notice($s) {
function info($s) {
$a = get_app();
if (local_user() AND get_pconfig(local_user(), 'system', 'ignore_info')) {
if (local_user() && get_pconfig(local_user(), 'system', 'ignore_info')) {
return;
}
@ -1063,7 +1063,7 @@ function proc_run($cmd) {
$arr = array('args' => $args, 'run_cmd' => true);
call_hooks("proc_run", $arr);
if (!$arr['run_cmd'] OR ! count($args)) {
if (!$arr['run_cmd'] || ! count($args)) {
return;
}
@ -1407,7 +1407,7 @@ function clear_cache($basepath = "", $path = "") {
$path = $basepath;
}
if (($path == "") OR (!is_dir($path))) {
if (($path == "") || (!is_dir($path))) {
return;
}
@ -1444,7 +1444,7 @@ function get_itemcachepath() {
}
$itemcache = get_config('system', 'itemcache');
if (($itemcache != "") AND App::directory_usable($itemcache)) {
if (($itemcache != "") && App::directory_usable($itemcache)) {
return $itemcache;
}
@ -1471,7 +1471,7 @@ function get_itemcachepath() {
*/
function get_spoolpath() {
$spoolpath = get_config('system', 'spoolpath');
if (($spoolpath != "") AND App::directory_usable($spoolpath)) {
if (($spoolpath != "") && App::directory_usable($spoolpath)) {
// We have a spool path and it is usable
return $spoolpath;
}
@ -1506,7 +1506,7 @@ function get_temppath() {
$temppath = get_config("system", "temppath");
if (($temppath != "") AND App::directory_usable($temppath)) {
if (($temppath != "") && App::directory_usable($temppath)) {
// We have a temp path and it is usable
return $temppath;
}
@ -1515,7 +1515,7 @@ function get_temppath() {
$temppath = sys_get_temp_dir();
// Check if it is usable
if (($temppath != "") AND App::directory_usable($temppath)) {
if (($temppath != "") && App::directory_usable($temppath)) {
// To avoid any interferences with other systems we create our own directory
$new_temppath = $temppath . "/" . $a->get_hostname();
if (!is_dir($new_temppath)) {
@ -1638,7 +1638,7 @@ function argv($x) {
function infinite_scroll_data($module) {
if (get_pconfig(local_user(), 'system', 'infinite_scroll')
AND ($module == "network") AND ($_GET["mode"] != "minimal")) {
&& ($module == "network") && ($_GET["mode"] != "minimal")) {
// get the page number
if (is_string($_GET["page"])) {
@ -1651,12 +1651,12 @@ function infinite_scroll_data($module) {
// try to get the uri from which we load the content
foreach ($_GET AS $param => $value) {
if (($param != "page") AND ($param != "q")) {
if (($param != "page") && ($param != "q")) {
$reload_uri .= "&" . $param . "=" . urlencode($value);
}
}
if (($a->page_offset != "") AND ! strstr($reload_uri, "&offset=")) {
if (($a->page_offset != "") && ! strstr($reload_uri, "&offset=")) {
$reload_uri .= "&offset=" . urlencode($a->page_offset);
}

+ 13
- 13
include/Contact.php View File

@ -262,33 +262,33 @@ function get_contact_details_by_url($url, $uid = -1, $default = array()) {
$profile = $default;
}
if (($profile["photo"] == "") AND isset($default["photo"])) {
if (($profile["photo"] == "") && isset($default["photo"])) {
$profile["photo"] = $default["photo"];
}
if (($profile["name"] == "") AND isset($default["name"])) {
if (($profile["name"] == "") && isset($default["name"])) {
$profile["name"] = $default["name"];
}
if (($profile["network"] == "") AND isset($default["network"])) {
if (($profile["network"] == "") && isset($default["network"])) {
$profile["network"] = $default["network"];
}
if (($profile["thumb"] == "") AND isset($profile["photo"])) {
if (($profile["thumb"] == "") && isset($profile["photo"])) {
$profile["thumb"] = $profile["photo"];
}
if (($profile["micro"] == "") AND isset($profile["thumb"])) {
if (($profile["micro"] == "") && isset($profile["thumb"])) {
$profile["micro"] = $profile["thumb"];
}
if ((($profile["addr"] == "") OR ($profile["name"] == "")) AND ($profile["gid"] != 0) AND
if ((($profile["addr"] == "") || ($profile["name"] == "")) && ($profile["gid"] != 0) &&
in_array($profile["network"], array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) {
proc_run(PRIORITY_LOW, "include/update_gcontact.php", $profile["gid"]);
}
// Show contact details of Diaspora contacts only if connected
if (($profile["cid"] == 0) AND ($profile["network"] == NETWORK_DIASPORA)) {
if (($profile["cid"] == 0) && ($profile["network"] == NETWORK_DIASPORA)) {
$profile["location"] = "";
$profile["about"] = "";
$profile["gender"] = "";
@ -559,7 +559,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
// Update the contact every 7 days
$update_photo = ($contacts[0]['avatar-date'] < datetime_convert('','','now -7 days'));
if (!$update_photo OR $no_update) {
if (!$update_photo || $no_update) {
return $contact_id;
}
} elseif ($uid != 0) {
@ -636,7 +636,7 @@ function get_contact($url, $uid = 0, $no_update = false) {
}
}
if (count($contacts) > 1 AND $uid == 0 AND $contact_id != 0 AND $url != "") {
if (count($contacts) > 1 && $uid == 0 && $contact_id != 0 && $url != "") {
q("DELETE FROM `contact` WHERE `nurl` = '%s' AND `id` != %d AND NOT `self`",
dbesc(normalise_link($url)),
intval($contact_id));
@ -654,9 +654,9 @@ function get_contact($url, $uid = 0, $no_update = false) {
}
// Only update if there had something been changed
if ($data["addr"] != $contacts[0]["addr"] OR
$data["alias"] != $contacts[0]["alias"] OR
$data["name"] != $contacts[0]["name"] OR
if ($data["addr"] != $contacts[0]["addr"] ||
$data["alias"] != $contacts[0]["alias"] ||
$data["name"] != $contacts[0]["name"] ||
$data["nick"] != $contacts[0]["nick"]) {
q("UPDATE `contact` SET `addr` = '%s', `alias` = '%s', `name` = '%s', `nick` = '%s',
`name-date` = '%s', `uri-date` = '%s' WHERE `id` = %d",
@ -769,7 +769,7 @@ function formatted_location($profile) {
if($profile['locality'])
$location .= $profile['locality'];
if($profile['region'] AND ($profile['locality'] != $profile['region'])) {
if($profile['region'] && ($profile['locality'] != $profile['region'])) {
if($location)
$location .= ', ';

+ 6
- 6
include/Photo.php View File

@ -785,7 +785,7 @@ function update_contact_avatar($avatar, $uid, $cid, $force = false) {
$data = array($r[0]["photo"], $r[0]["thumb"], $r[0]["micro"]);
}
if (($r[0]["avatar"] != $avatar) OR $force) {
if (($r[0]["avatar"] != $avatar) || $force) {
$photos = import_profile_photo($avatar, $uid, $cid, true);
if ($photos) {
@ -825,7 +825,7 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) {
$filename = basename($photo);
$img_str = fetch_url($photo, true);
if ($quit_on_error AND ($img_str == "")) {
if ($quit_on_error && ($img_str == "")) {
return false;
}
@ -883,7 +883,7 @@ function import_profile_photo($photo, $uid, $cid, $quit_on_error = false) {
$photo_failure = true;
}
if ($photo_failure AND $quit_on_error) {
if ($photo_failure && $quit_on_error) {
return false;
}
@ -902,7 +902,7 @@ function get_photo_info($url) {
$data = Cache::get($url);
if (is_null($data) OR !$data OR !is_array($data)) {
if (is_null($data) || !$data || !is_array($data)) {
$img_str = fetch_url($url, true, $redirects, 4);
$filesize = strlen($img_str);
@ -996,7 +996,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") {
/// $default_cid = $r[0]['id'];
/// $community_page = (($r[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
if ((strlen($imagedata) == 0) AND ($url == "")) {
if ((strlen($imagedata) == 0) && ($url == "")) {
logger("No image data and no url provided", LOGGER_DEBUG);
return(array());
} elseif (strlen($imagedata) == 0) {
@ -1102,7 +1102,7 @@ function store_photo(App $a, $uid, $imagedata = "", $url = "") {
}
}
if ($width > 160 AND $height > 160) {
if ($width > 160 && $height > 160) {
$x = 0;
$y = 0;

+ 2
- 2
include/acl_selectors.php View File

@ -209,7 +209,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$tabindex = ($tabindex > 0 ? "tabindex=\"$tabindex\"" : "");
if ($privmail AND $preselected) {
if ($privmail && $preselected) {
$sql_extra .= " AND `id` IN (".implode(",", $preselected).")";
$hidepreselected = ' style="display: none;"';
} else {
@ -261,7 +261,7 @@ function contact_select($selname, $selclass, $preselected = false, $size = 4, $p
$o .= "</select>\r\n";
if ($privmail AND $preselected) {
if ($privmail && $preselected) {
$o .= implode(", ", $receiverlist);
}

+ 30
- 30
include/api.php View File

@ -483,7 +483,7 @@ $called_api = null;
logger("api_get_user: Fetching user data for user ".$contact_id, LOGGER_DEBUG);
// Searching for contact URL
if (!is_null($contact_id) AND (intval($contact_id) == 0)) {
if (!is_null($contact_id) && (intval($contact_id) == 0)) {
$user = dbesc(normalise_link($contact_id));
$url = $user;
$extra_query = "AND `contact`.`nurl` = '%s' ";
@ -493,7 +493,7 @@ $called_api = null;
}
// Searching for contact id with uid = 0
if (!is_null($contact_id) AND (intval($contact_id) != 0)) {
if (!is_null($contact_id) && (intval($contact_id) != 0)) {
$user = dbesc(api_unique_id_to_url($contact_id));
if ($user == "") {
@ -538,7 +538,7 @@ $called_api = null;
}
}
if (is_null($user) AND ($a->argc > (count($called_api) - 1)) AND (count($called_api) > 0)) {
if (is_null($user) && ($a->argc > (count($called_api) - 1)) && (count($called_api) > 0)) {
$argid = count($called_api);
list($user, $null) = explode(".", $a->argv[$argid]);
if (is_numeric($user)) {
@ -600,7 +600,7 @@ $called_api = null;
$network_name = network_to_name($r[0]['network'], $r[0]['url']);
// If no nick where given, extract it from the address
if (($r[0]['nick'] == "") OR ($r[0]['name'] == $r[0]['nick'])) {
if (($r[0]['nick'] == "") || ($r[0]['name'] == $r[0]['nick'])) {
$r[0]['nick'] = api_get_nick($r[0]["url"]);
}
@ -716,7 +716,7 @@ $called_api = null;
$starred = 0;
// Add a nick if it isn't present there
if (($uinfo[0]['nick'] == "") OR ($uinfo[0]['name'] == $uinfo[0]['nick'])) {
if (($uinfo[0]['nick'] == "") || ($uinfo[0]['name'] == $uinfo[0]['nick'])) {
$uinfo[0]['nick'] = api_get_nick($uinfo[0]["url"]);
}
@ -749,7 +749,7 @@ $called_api = null;
'contributors_enabled' => false,
'is_translator' => false,
'is_translation_enabled' => false,
'following' => (($uinfo[0]['rel'] == CONTACT_IS_FOLLOWER) OR ($uinfo[0]['rel'] == CONTACT_IS_FRIEND)),
'following' => (($uinfo[0]['rel'] == CONTACT_IS_FOLLOWER) || ($uinfo[0]['rel'] == CONTACT_IS_FRIEND)),
'follow_request_sent' => false,
'statusnet_blocking' => false,
'notifications' => false,
@ -777,10 +777,10 @@ $called_api = null;
$status_user = api_get_user($a, $item["author-link"]);
$status_user["protected"] = (($item["allow_cid"] != "") OR
($item["allow_gid"] != "") OR
($item["deny_cid"] != "") OR
($item["deny_gid"] != "") OR
$status_user["protected"] = (($item["allow_cid"] != "") ||
($item["allow_gid"] != "") ||
($item["deny_cid"] != "") ||
($item["deny_gid"] != "") ||
$item["private"]);
if ($item['thr-parent'] == $item['uri']) {
@ -1305,9 +1305,9 @@ $called_api = null;
$status_info["entities"] = $converted["entities"];
}
if (($lastwall['item_network'] != "") AND ($status["source"] == 'web')) {
if (($lastwall['item_network'] != "") && ($status["source"] == 'web')) {
$status_info["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
} elseif (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network'], $user_info['url']) != $status_info["source"])) {
} elseif (($lastwall['item_network'] != "") && (network_to_name($lastwall['item_network'], $user_info['url']) != $status_info["source"])) {
$status_info["source"] = trim($status_info["source"].' ('.network_to_name($lastwall['item_network'], $user_info['url']).')');
}
@ -1393,11 +1393,11 @@ $called_api = null;
$user_info["status"]["entities"] = $converted["entities"];
}
if (($lastwall['item_network'] != "") AND ($user_info["status"]["source"] == 'web')) {
if (($lastwall['item_network'] != "") && ($user_info["status"]["source"] == 'web')) {
$user_info["status"]["source"] = network_to_name($lastwall['item_network'], $user_info['url']);
}
if (($lastwall['item_network'] != "") AND (network_to_name($lastwall['item_network'], $user_info['url']) != $user_info["status"]["source"])) {
if (($lastwall['item_network'] != "") && (network_to_name($lastwall['item_network'], $user_info['url']) != $user_info["status"]["source"])) {
$user_info["status"]["source"] = trim($user_info["status"]["source"] . ' (' . network_to_name($lastwall['item_network'], $user_info['url']) . ')');
}
@ -2289,11 +2289,11 @@ $called_api = null;
$statushtml = "<h4>" . bbcode($item['title']) . "</h4>\n" . $statushtml;
}
// feeds without body should contain the link
if (($item['network'] == NETWORK_FEED) && (strlen($item['body']) == 0)) {
$statushtml .= bbcode($item['plink']);
}
// feeds without body should contain the link
if (($item['network'] == NETWORK_FEED) && (strlen($item['body']) == 0)) {
$statushtml .= bbcode($item['plink']);
}
$entities = api_get_entitities($statustext, $body);
return array(
@ -2402,8 +2402,8 @@ $called_api = null;
$offset = 0;
//foreach ($urls[1] AS $id=>$url) {
foreach ($ordered_urls AS $url) {
if ((substr($url["title"], 0, 7) != "http://") AND (substr($url["title"], 0, 8) != "https://") AND
!strpos($url["title"], "http://") AND !strpos($url["title"], "https://"))
if ((substr($url["title"], 0, 7) != "http://") && (substr($url["title"], 0, 8) != "https://") &&
!strpos($url["title"], "http://") && !strpos($url["title"], "https://"))
$display_url = $url["title"];
else {
$display_url = str_replace(array("http://www.", "https://www."), array("", ""), $url["url"]);
@ -2455,7 +2455,7 @@ $called_api = null;
$scale = scale_image($image[0], $image[1], 150);
$sizes["thumb"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
if (($image[0] > 150) OR ($image[1] > 150)) {
if (($image[0] > 150) || ($image[1] > 150)) {
$scale = scale_image($image[0], $image[1], 340);
$sizes["small"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
}
@ -2463,7 +2463,7 @@ $called_api = null;
$scale = scale_image($image[0], $image[1], 600);
$sizes["medium"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
if (($image[0] > 600) OR ($image[1] > 600)) {
if (($image[0] > 600) || ($image[1] > 600)) {
$scale = scale_image($image[0], $image[1], 1024);
$sizes["large"] = array("w" => $scale["width"], "h" => $scale["height"], "resize" => "fit");
}
@ -2668,7 +2668,7 @@ $called_api = null;
list($status_user, $owner_user) = api_item_get_user($a, $item);
// Look if the posts are matching if they should be filtered by user id
if ($filter_user AND ($status_user["id"] != $user_info["id"])) {
if ($filter_user && ($status_user["id"] != $user_info["id"])) {
continue;
}
@ -2712,9 +2712,9 @@ $called_api = null;
$status["entities"] = $converted["entities"];
}
if (($item['item_network'] != "") AND ($status["source"] == 'web')) {
if (($item['item_network'] != "") && ($status["source"] == 'web')) {
$status["source"] = network_to_name($item['item_network'], $user_info['url']);
} elseif (($item['item_network'] != "") AND (network_to_name($item['item_network'], $user_info['url']) != $status["source"])) {
} elseif (($item['item_network'] != "") && (network_to_name($item['item_network'], $user_info['url']) != $status["source"])) {
$status["source"] = trim($status["source"].' ('.network_to_name($item['item_network'], $user_info['url']).')');
}
@ -2723,7 +2723,7 @@ $called_api = null;
// It doesn't work reliable with the link if its a feed
//$IsRetweet = ($item['owner-link'] != $item['author-link']);
//if ($IsRetweet)
// $IsRetweet = (($item['owner-name'] != $item['author-name']) OR ($item['owner-avatar'] != $item['author-avatar']));
// $IsRetweet = (($item['owner-name'] != $item['author-name']) || ($item['owner-avatar'] != $item['author-avatar']));
if ($item["id"] == $item["parent"]) {
@ -3022,7 +3022,7 @@ $called_api = null;
if (api_user() === false) throw new ForbiddenException();
if (!x($_POST, "text") OR (!x($_POST,"screen_name") AND !x($_POST,"user_id"))) return;
if (!x($_POST, "text") || (!x($_POST,"screen_name") && !x($_POST,"user_id"))) return;
$sender = api_get_user($a);
@ -4334,7 +4334,7 @@ $called_api = null;
$in_reply_to['user_id_str'] = NULL;
$in_reply_to['screen_name'] = NULL;
if (($item['thr-parent'] != $item['uri']) AND (intval($item['parent']) != intval($item['id']))) {
if (($item['thr-parent'] != $item['uri']) && (intval($item['parent']) != intval($item['id']))) {
$r = q("SELECT `id` FROM `item` WHERE `uid` = %d AND `uri` = '%s' LIMIT 1",
intval($item['uid']),
dbesc($item['thr-parent']));
@ -4415,7 +4415,7 @@ $called_api = null;
if (isset($data["text"]))
$body = $data["text"];
if (($body == "") AND (isset($data["title"])))
if (($body == "") && (isset($data["title"])))
$body = $data["title"];
if (isset($data["url"]))

+ 1
- 1
include/auth.php View File

@ -29,7 +29,7 @@ if (isset($_COOKIE["Friendica"])) {
new_cookie($authcookiedays*24*60*60, $r[0]);
// Do the authentification if not done by now
if (!isset($_SESSION) OR !isset($_SESSION['authenticated'])) {
if (!isset($_SESSION) || !isset($_SESSION['authenticated'])) {
authenticate_success($r[0]);
if (get_config('system','paranoia'))

+ 18
- 18
include/bbcode.php View File

@ -49,14 +49,14 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
$data["title"] = str_replace(array("http://", "https://"), "", $data["title"]);
}
if (((strpos($data["text"], "[img=") !== false) OR (strpos($data["text"], "[img]") !== false)) AND ($data["image"] != "")) {
if (((strpos($data["text"], "[img=") !== false) || (strpos($data["text"], "[img]") !== false)) && ($data["image"] != "")) {
$data["preview"] = $data["image"];
$data["image"] = "";
}
if ($simplehtml == 7) {
$text = style_url_for_mastodon($data["url"]);
} elseif (($simplehtml != 4) AND ($simplehtml != 0)) {
} elseif (($simplehtml != 4) && ($simplehtml != 0)) {
$text = sprintf('<a href="%s" target="_blank">%s</a><br>', $data["url"], $data["title"]);
} else {
$text = sprintf('<span class="type-%s">', $data["type"]);
@ -71,13 +71,13 @@ function bb_attachment($Text, $simplehtml = false, $tryoembed = true) {
if (strstr(strtolower($oembed), "<iframe ")) {
$text = $oembed;
} else {
if (($data["image"] != "") AND !strstr(strtolower($oembed), "<img ")) {
if (($data["image"] != "") && !strstr(strtolower($oembed), "<img ")) {
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a><br />', $data["url"], proxy_url($data["image"]), $data["title"]);
} elseif (($data["preview"] != "") AND !strstr(strtolower($oembed), "<img ")) {
} elseif (($data["preview"] != "") && !strstr(strtolower($oembed), "<img ")) {
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-preview" /></a><br />', $data["url"], proxy_url($data["preview"]), $data["title"]);
}
if (($data["type"] == "photo") AND ($data["url"] != "") AND ($data["image"] != "")) {
if (($data["type"] == "photo") && ($data["url"] != "") && ($data["image"] != "")) {
$text .= sprintf('<a href="%s" target="_blank"><img src="%s" alt="" title="%s" class="attachment-image" /></a>', $data["url"], proxy_url($data["image"]), $data["title"]);
} else {
$text .= $oembed;
@ -103,25 +103,25 @@ function bb_remove_share_information($Text, $plaintext = false, $nolink = false)
$title = htmlentities($data["title"], ENT_QUOTES, 'UTF-8', false);
$text = htmlentities($data["text"], ENT_QUOTES, 'UTF-8', false);
if ($plaintext OR (($title != "") AND strstr($text, $title))) {
if ($plaintext || (($title != "") && strstr($text, $title))) {
$data["title"] = $data["url"];
} elseif (($text != "") AND strstr($title, $text)) {
} elseif (($text != "") && strstr($title, $text)) {
$data["text"] = $data["title"];
$data["title"] = $data["url"];
}
if (($data["text"] == "") AND ($data["title"] != "") AND ($data["url"] == "")) {
if (($data["text"] == "") && ($data["title"] != "") && ($data["url"] == "")) {
return $data["title"] . $data["after"];
}
// If the link already is included in the post, don't add it again
if (($data["url"] != "") AND strpos($data["text"], $data["url"])) {
if (($data["url"] != "") && strpos($data["text"], $data["url"])) {
return $data["text"] . $data["after"];
}
$text = $data["text"];
if (($data["url"] != "") AND ($data["title"] != "")) {
if (($data["url"] != "") && ($data["title"] != "")) {
$text .= "\n[url=" . $data["url"] . "]" . $data["title"] . "[/url]";
} elseif (($data["url"] != "")) {
$text .= "\n" . $data["url"];
@ -167,7 +167,7 @@ function cleancss($input) {
function bb_style_url($match) {
$url = $match[1];
if (isset($match[2]) AND ($match[1] != $match[2])) {
if (isset($match[2]) && ($match[1] != $match[2])) {
return $match[0];
}
@ -485,20 +485,20 @@ function bb_ShareAttributes($share, $simplehtml) {
$data = get_contact_details_by_url($profile);
if (isset($data["name"]) AND ($data["name"] != "") AND isset($data["addr"]) AND ($data["addr"] != ""))
if (isset($data["name"]) && ($data["name"] != "") && isset($data["addr"]) && ($data["addr"] != ""))
$userid_compact = $data["name"]." (".$data["addr"].")";
else
$userid_compact = GetProfileUsername($profile,$author, true);
if (isset($data["addr"]) AND ($data["addr"] != ""))
if (isset($data["addr"]) && ($data["addr"] != ""))
$userid = $data["addr"];
else
$userid = GetProfileUsername($profile,$author, false);
if (isset($data["name"]) AND ($data["name"] != ""))
if (isset($data["name"]) && ($data["name"] != ""))
$author = $data["name"];
if (isset($data["micro"]) AND ($data["micro"] != ""))
if (isset($data["micro"]) && ($data["micro"] != ""))
$avatar = $data["micro"];
$preshare = trim($share[1]);
@ -744,7 +744,7 @@ function bb_RemovePictureLinks($match) {
}
function bb_expand_links($match) {
if (($match[3] == "") OR ($match[2] == $match[3]) OR stristr($match[2], $match[3])) {
if (($match[3] == "") || ($match[2] == $match[3]) || stristr($match[2], $match[3])) {
return ($match[1] . "[url]" . $match[2] . "[/url]");
} else {
return ($match[1] . $match[3] . " [url]" . $match[2] . "[/url]");
@ -930,7 +930,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
$MAILSearchString = $URLSearchString;
// Remove all hashtag addresses
if ((!$tryoembed OR $simplehtml) AND !in_array($simplehtml, array(3, 7))) {
if ((!$tryoembed || $simplehtml) && !in_array($simplehtml, array(3, 7))) {
$Text = preg_replace("/([#@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism", '$1$3', $Text);
} elseif ($simplehtml == 3) {
$Text = preg_replace("/([@])\[url\=([$URLSearchString]*)\](.*?)\[\/url\]/ism",
@ -1319,7 +1319,7 @@ function bbcode($Text, $preserve_nl = false, $tryoembed = true, $simplehtml = fa
// Clean up the HTML by loading and saving the HTML with the DOM.
// Bad structured html can break a whole page.
// For performance reasons do it only with ativated item cache or at export.
if (!$tryoembed OR (get_itemcachepath() != "")) {
if (!$tryoembed || (get_itemcachepath() != "")) {
$doc = new DOMDocument();
$doc->preserveWhiteSpace = false;

+ 5
- 5
include/cache.php View File

@ -172,35 +172,35 @@ class Cache {
set_config("system", "cache_cleared_day", time());
}
if (($max_level <= CACHE_HOUR) AND (get_config("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
if (($max_level <= CACHE_HOUR) && (get_config("system", "cache_cleared_hour")) < time() - self::duration(CACHE_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 1 hours")), intval(CACHE_HOUR));
set_config("system", "cache_cleared_hour", time());
}
if (($max_level <= CACHE_HALF_HOUR) AND (get_config("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
if (($max_level <= CACHE_HALF_HOUR) && (get_config("system", "cache_cleared_half_hour")) < time() - self::duration(CACHE_HALF_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 30 minutes")), intval(CACHE_HALF_HOUR));
set_config("system", "cache_cleared_half_hour", time());
}
if (($max_level <= CACHE_QUARTER_HOUR) AND (get_config("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
if (($max_level <= CACHE_QUARTER_HOUR) && (get_config("system", "cache_cleared_quarter_hour")) < time() - self::duration(CACHE_QUARTER_HOUR)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 15 minutes")), intval(CACHE_QUARTER_HOUR));
set_config("system", "cache_cleared_quarter_hour", time());
}
if (($max_level <= CACHE_FIVE_MINUTES) AND (get_config("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
if (($max_level <= CACHE_FIVE_MINUTES) && (get_config("system", "cache_cleared_five_minute")) < time() - self::duration(CACHE_FIVE_MINUTES)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 5 minutes")), intval(CACHE_FIVE_MINUTES));
set_config("system", "cache_cleared_five_minute", time());
}
if (($max_level <= CACHE_MINUTE) AND (get_config("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
if (($max_level <= CACHE_MINUTE) && (get_config("system", "cache_cleared_minute")) < time() - self::duration(CACHE_MINUTE)) {
q("DELETE FROM `cache` WHERE `updated` < '%s' AND `expire_mode` = %d",
dbesc(datetime_convert('UTC','UTC',"now - 1 minutes")), intval(CACHE_MINUTE));

+ 1
- 1
include/contact_selectors.php View File

@ -100,7 +100,7 @@ function network_to_name($s, $profile = "") {
$networkname = str_replace($search, $replace, $s);
if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) AND ($profile != "")) {
if ((in_array($s, array(NETWORK_DFRN, NETWORK_DIASPORA, NETWORK_OSTATUS))) && ($profile != "")) {
$r = q("SELECT `gserver`.`platform` FROM `gcontact`
INNER JOIN `gserver` ON `gserver`.`nurl` = `gcontact`.`server_url`
WHERE `gcontact`.`nurl` = '%s' AND `platform` != ''",

+ 1
- 1
include/contact_widgets.php View File

@ -51,7 +51,7 @@ function unavailable_networks() {
$networks[] = NETWORK_APPNET;
}
if (!plugin_enabled("fbpost") AND !plugin_enabled("facebook")) {
if (!plugin_enabled("fbpost") && !plugin_enabled("facebook")) {
$networks[] = NETWORK_FACEBOOK;
}

+ 3
- 3
include/conversation.php View File

@ -712,7 +712,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
$profile_link = zrl($profile_link);
}
if (!x($item, 'author-thumb') OR ($item['author-thumb'] == "")) {
if (!x($item, 'author-thumb') || ($item['author-thumb'] == "")) {
$author_contact = get_contact_details_by_url($item['author-link'], $profile_owner);
if ($author_contact["thumb"]) {
$item['author-thumb'] = $author_contact["thumb"];
@ -721,7 +721,7 @@ function conversation(App $a, $items, $mode, $update, $preview = false) {
}
}
if (!isset($item['owner-thumb']) OR ($item['owner-thumb'] == "")) {
if (!isset($item['owner-thumb']) || ($item['owner-thumb'] == "")) {
$owner_contact = get_contact_details_by_url($item['owner-link'], $profile_owner);
if ($owner_contact["thumb"]) {
$item['owner-thumb'] = $owner_contact["thumb"];
@ -1013,7 +1013,7 @@ function item_photo_menu($item) {
$menu[t("Poke")] = $poke_link;
}
if ((($cid == 0) OR ($rel == CONTACT_IS_FOLLOWER)) AND
if ((($cid == 0) || ($rel == CONTACT_IS_FOLLOWER)) &&
in_array($item['network'], array(NETWORK_DFRN, NETWORK_OSTATUS, NETWORK_DIASPORA))) {
$menu[t('Connect/Follow')] = 'follow?url=' . urlencode($item['author-link']);
}

+ 3
- 3
include/cron.php View File

@ -186,7 +186,7 @@ function cron_poll_contacts($argc, $argv) {
$contact['priority'] = 2;
}
if ($contact['subhub'] AND in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
if ($contact['subhub'] && in_array($contact['network'], array(NETWORK_DFRN, NETWORK_ZOT, NETWORK_OSTATUS))) {
/*
* We should be getting everything via a hub. But just to be sure, let's check once a day.
* (You can make this more or less frequent if desired by setting 'pushpoll_frequency' appropriately)
@ -197,7 +197,7 @@ function cron_poll_contacts($argc, $argv) {
$contact['priority'] = (($poll_interval !== false) ? intval($poll_interval) : 3);
}
if (($contact['priority'] >= 0) AND !$force) {
if (($contact['priority'] >= 0) && !$force) {
$update = false;
$t = $contact['last-update'];
@ -245,7 +245,7 @@ function cron_poll_contacts($argc, $argv) {
logger("Polling " . $contact["network"] . " " . $contact["id"] . " " . $contact["nick"] . " " . $contact["name"]);
if (($contact['network'] == NETWORK_FEED) AND ($contact['priority'] <= 3)) {
if (($contact['network'] == NETWORK_FEED) && ($contact['priority'] <= 3)) {
$priority = PRIORITY_MEDIUM;
} else {
$priority = PRIORITY_LOW;

+ 2
- 2
include/cronhooks.php View File

@ -7,7 +7,7 @@ function cronhooks_run(&$argv, &$argc) {
require_once 'include/datetime.php';
if (($argc == 2) AND is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
if (($argc == 2) && is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
foreach ($a->hooks["cron"] as $hook) {
if ($hook[1] == $argv[1]) {
logger("Calling cron hook '" . $hook[1] . "'", LOGGER_DEBUG);
@ -38,7 +38,7 @@ function cronhooks_run(&$argv, &$argc) {
$d = datetime_convert();
if (is_array($a->hooks) AND array_key_exists("cron", $a->hooks)) {
if (is_array($a->hooks) && array_key_exists("cron", $a->hooks)) {
foreach ($a->hooks["cron"] as $hook) {
logger("Calling cronhooks for '" . $hook[1] . "'", LOGGER_DEBUG);
proc_run(PRIORITY_MEDIUM, "include/cronhooks.php", $hook[1]);

+ 11
- 11
include/dba.php View File

@ -117,7 +117,7 @@ class dba {
/**
* @brief Returns the MySQL server version string
*
*
* This function discriminate between the deprecated mysql API and the current
* object-oriented mysqli API. Example of returned string: 5.5.46-0+deb8u1
*
@ -183,17 +183,17 @@ class dba {
foreach ($r AS $row) {
if ((intval($a->config["system"]["db_loglimit_index"]) > 0)) {
$log = (in_array($row['key'], $watchlist) AND
$log = (in_array($row['key'], $watchlist) &&
($row['rows'] >= intval($a->config["system"]["db_loglimit_index"])));
} else {
$log = false;
}
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) AND ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
if ((intval($a->config["system"]["db_loglimit_index_high"]) > 0) && ($row['rows'] >= intval($a->config["system"]["db_loglimit_index_high"]))) {
$log = true;
}
if (in_array($row['key'], $blacklist) OR ($row['key'] == "")) {
if (in_array($row['key'], $blacklist) || ($row['key'] == "")) {
$log = false;
}
@ -363,7 +363,7 @@ class dba {
// PDO doesn't return "true" on successful operations - like mysqli does
// Emulate this behaviour by checking if the query returned data and had columns
// This should be reliable enough
if (($this->driver == 'pdo') AND (count($r) == 0) AND ($columns == 0)) {
if (($this->driver == 'pdo') && (count($r) == 0) && ($columns == 0)) {
return true;
}
@ -490,7 +490,7 @@ class dba {
static private function replace_parameters($sql, $args) {
$offset = 0;
foreach ($args AS $param => $value) {
if (is_int($args[$param]) OR is_float($args[$param])) {
if (is_int($args[$param]) || is_float($args[$param])) {
$replace = intval($args[$param]);
} else {
$replace = "'".self::$dbo->escape($args[$param])."'";
@ -520,7 +520,7 @@ class dba {
unset($args[0]);
// When the second function parameter is an array then use this as the parameter array
if ((count($args) > 0) AND (is_array($args[1]))) {
if ((count($args) > 0) && (is_array($args[1]))) {
$params = $args[1];
} else {
$params = $args;
@ -533,7 +533,7 @@ class dba {
$args[++$i] = $param;
}
if (!self::$dbo OR !self::$dbo->connected) {
if (!self::$dbo || !self::$dbo->connected) {
return false;
}
@ -948,7 +948,7 @@ class dba {
// When the search field is the relation field, we don't need to fetch the rows
// This is useful when the leading record is already deleted in the frontend but the rest is done in the backend
if ((count($param) == 1) AND ($field == array_keys($param)[0])) {
if ((count($param) == 1) && ($field == array_keys($param)[0])) {
foreach ($rel_def AS $rel_table => $rel_fields) {
foreach ($rel_fields AS $rel_field) {
$retval = self::delete($rel_table, array($rel_field => array_values($param)[0]), true, $callstack);
@ -1110,7 +1110,7 @@ class dba {
}
}
if (!$do_update OR (count($fields) == 0)) {
if (!$do_update || (count($fields) == 0)) {
return true;
}
@ -1190,7 +1190,7 @@ class dba {
$result = self::p($sql, $condition);
if (is_bool($result) OR !$single_row) {
if (is_bool($result) || !$single_row) {
return $result;
} else {
$row = self::fetch($result);

+ 2
- 2
include/dba_pdo.php View File

@ -190,14 +190,14 @@ class dba {
* regardless of any logging that may or may nor be in effect.
* These usually indicate SQL syntax errors that need to be resolved.
*/
if (isset($result) AND ($result === false)) {
if (isset($result) && ($result === false)) {
logger('dba: ' . printable($sql) . ' returned false.' . "\n" . $this->error);
if (file_exists('dbfail.out')) {
file_put_contents('dbfail.out', datetime_convert() . "\n" . printable($sql) . ' returned false' . "\n" . $this->error . "\n", FILE_APPEND);
}
}
if (isset($result) AND (($result === true) || ($result === false))) {
if (isset($result) && (($result === true) || ($result === false))) {
return $result;
}

+ 2
- 2
include/dbclean.php View File

@ -24,7 +24,7 @@ function dbclean_run(&$argv, &$argc) {
for ($i = 1; $i <= 9; $i++) {
// Execute the background script for a step when it isn't finished.
// Execute step 8 and 9 only when $days is defined.
if (!Config::get('system', 'finished-dbclean-'.$i, false) AND (($i < 8) OR ($days > 0))) {
if (!Config::get('system', 'finished-dbclean-'.$i, false) && (($i < 8) || ($days > 0))) {
proc_run(PRIORITY_LOW, 'include/dbclean.php', $i);
}
}
@ -296,7 +296,7 @@ function remove_orphans($stage = 0) {
}
// Call it again if not all entries were purged
if (($stage != 0) AND ($count > 0)) {
if (($stage != 0) && ($count > 0)) {
proc_run(PRIORITY_MEDIUM, 'include/dbclean.php');
}
}

+ 1
- 1
include/dbm.php View File

@ -76,7 +76,7 @@ class dbm {
if (is_bool($value)) {
$value = ($value ? 'true' : 'false');
} elseif (is_float($value) OR is_integer($value)) {
} elseif (is_float($value) || is_integer($value)) {
$value = (string)$value;
} else {
$value = "'".dbesc($value)."'";

+ 5
- 5
include/dbstructure.php View File

@ -133,7 +133,7 @@ function table_structure($table) {
// On utf8mb4 a varchar index can only have a length of 191
// The "show index" command sometimes returns this value although this value wasn't added manually.
// Because we don't want to add this number to every index, we ignore bigger numbers
if (($index["Sub_part"] != "") AND (($index["Sub_part"] < 191) OR ($index["Key_name"] == "PRIMARY"))) {
if (($index["Sub_part"] != "") && (($index["Sub_part"] < 191) || ($index["Key_name"] == "PRIMARY"))) {
$column .= "(".$index["Sub_part"].")";
}
@ -232,7 +232,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
}
// MySQL >= 5.7.4 doesn't support the IGNORE keyword in ALTER TABLE statements
if ((version_compare($db->server_info(), '5.7.4') >= 0) AND
if ((version_compare($db->server_info(), '5.7.4') >= 0) &&
!(strpos($db->server_info(), 'MariaDB') !== false)) {
$ignore = '';
} else {
@ -381,7 +381,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
$field_definition = $database[$name]["fields"][$fieldname];
// Define the default collation if not given
if (!isset($parameters['Collation']) AND !is_null($field_definition['Collation'])) {
if (!isset($parameters['Collation']) && !is_null($field_definition['Collation'])) {
$parameters['Collation'] = 'utf8mb4_general_ci';
} else {
$parameters['Collation'] = null;
@ -389,7 +389,7 @@ function update_structure($verbose, $action, $tables=null, $definition=null) {
if ($field_definition['Collation'] != $parameters['Collation']) {
$sql2 = db_modify_table_field($fieldname, $parameters);
if (($sql3 == "") OR (substr($sql3, -2, 2) == "; ")) {
if (($sql3 == "") || (substr($sql3, -2, 2) == "; ")) {
$sql3 .= "ALTER" . $ignore . " TABLE `".$temp_name."` ".$sql2;
} else {
$sql3 .= ", ".$sql2;
@ -513,7 +513,7 @@ function db_field_command($parameters, $create = true) {
if ($parameters["extra"] != "")
$fieldstruct .= " ".$parameters["extra"];
/*if (($parameters["primary"] != "") AND $create)
/*if (($parameters["primary"] != "") && $create)
$fieldstruct .= " PRIMARY KEY";*/
return($fieldstruct);

+ 3
- 3
include/delivery.php View File

@ -339,7 +339,7 @@ function delivery_run(&$argv, &$argc){
// If we are setup as a soapbox we aren't accepting top level posts from this person
if (($x[0]['page-flags'] == PAGE_SOAPBOX) AND $top_level) {
if (($x[0]['page-flags'] == PAGE_SOAPBOX) && $top_level) {
break;
}
logger('mod-delivery: local delivery');
@ -462,14 +462,14 @@ function delivery_run(&$argv, &$argc){
dbesc($it['parent-uri']),
intval($uid));
if (dbm::is_result($r) AND ($r[0]['title'] != '')) {
if (dbm::is_result($r) && ($r[0]['title'] != '')) {
$subject = $r[0]['title'];
} else {
$r = q("SELECT `title` FROM `item` WHERE `parent-uri` = '%s' AND `uid` = %d LIMIT 1",
dbesc($it['parent-uri']),
intval($uid));
if (dbm::is_result($r) AND ($r[0]['title'] != ''))
if (dbm::is_result($r) && ($r[0]['title'] != ''))
$subject = $r[0]['title'];
}
}

+ 18
- 18
include/dfrn.php View File

@ -245,7 +245,7 @@ class dfrn {
/// @TODO This hook can't work anymore
// call_hooks('atom_feed', $atom);
if (!dbm::is_result($items) OR $onlyheader) {
if (!dbm::is_result($items) || $onlyheader) {
$atom = trim($doc->saveXML());
call_hooks('atom_feed_end', $atom);
@ -508,7 +508,7 @@ class dfrn {
$attributes = array();
if (!$public OR !$hidewall) {
if (!$public || !$hidewall) {
$attributes = array("dfrn:updated" => $namdate);
}
@ -519,7 +519,7 @@ class dfrn {
$attributes = array("rel" => "photo", "type" => "image/jpeg",
"media:width" => 175, "media:height" => 175, "href" => $owner['photo']);
if (!$public OR !$hidewall) {
if (!$public || !$hidewall) {
$attributes["dfrn:updated"] = $picdate;
}
@ -921,7 +921,7 @@ class dfrn {
if (count($tags)) {
foreach ($tags as $t) {
if (($type != 'html') OR ($t[0] != "@")) {
if (($type != 'html') || ($t[0] != "@")) {
xml::add_element($doc, $entry, "category", "", array("scheme" => "X-DFRN:".$t[0].":".$t[1], "term" => $t[2]));
}
}
@ -940,7 +940,7 @@ class dfrn {
intval($owner["uid"]),
dbesc(normalise_link($mention)));
if (dbm::is_result($r) AND ($r[0]["forum"] OR $r[0]["prv"])) {
if (dbm::is_result($r) && ($r[0]["forum"] || $r[0]["prv"])) {
xml::add_element($doc, $entry, "link", "", array("rel" => "mentioned",
"ostatus:object-type" => ACTIVITY_OBJ_GROUP,
"href" => $mention));
@ -1323,7 +1323,7 @@ class dfrn {
$contact["avatar-date"] = $attributes->textContent;
}
}
if (($width > 0) AND ($href != "")) {
if (($width > 0) && ($href != "")) {
$avatarlist[$width] = $href;
}
}
@ -1332,7 +1332,7 @@ class dfrn {
$author["avatar"] = current($avatarlist);
}
if (dbm::is_result($r) AND !$onlyfetch) {
if (dbm::is_result($r) && !$onlyfetch) {
logger("Check if contact details for contact " . $r[0]["id"] . " (" . $r[0]["nick"] . ") have to be updated.", LOGGER_DEBUG);
$poco = array("url" => $contact["url"]);
@ -1774,7 +1774,7 @@ class dfrn {
$relocate["poll"] = $xpath->query("dfrn:poll/text()", $relocation)->item(0)->nodeValue;
$relocate["sitepubkey"] = $xpath->query("dfrn:sitepubkey/text()", $relocation)->item(0)->nodeValue;
if (($relocate["avatar"] == "") AND ($relocate["photo"] != "")) {
if (($relocate["avatar"] == "") && ($relocate["photo"] != "")) {
$relocate["avatar"] = $relocate["photo"];
}
@ -1922,7 +1922,7 @@ class dfrn {
}
// update last-child if it changes
if ($item["last-child"] AND ($item["last-child"] != $current["last-child"])) {
if ($item["last-child"] && ($item["last-child"] != $current["last-child"])) {
$r = q("UPDATE `item` SET `last-child` = 0, `changed` = '%s' WHERE `parent-uri` = '%s' AND `uid` = %d",
dbesc(datetime_convert()),
dbesc($item["parent-uri"]),
@ -2206,7 +2206,7 @@ class dfrn {
$title = $attributes->textContent;
}
}
if (($rel != "") AND ($href != "")) {
if (($rel != "") && ($href != "")) {
switch ($rel) {
case "alternate":
$item["plink"] = $href;
@ -2254,7 +2254,7 @@ class dfrn {
);
// Is there an existing item?
if (dbm::is_result($current) AND edited_timestamp_is_newer($current[0], $item) AND
if (dbm::is_result($current) && edited_timestamp_is_newer($current[0], $item) &&
(datetime_convert("UTC","UTC",$item["edited"]) < $current[0]["edited"])) {
logger("Item ".$item["uri"]." already existed.", LOGGER_DEBUG);
return;
@ -2328,7 +2328,7 @@ class dfrn {
}
$notice_info = $xpath->query("statusnet:notice_info", $entry);
if ($notice_info AND ($notice_info->length > 0)) {
if ($notice_info && ($notice_info->length > 0)) {
foreach ($notice_info->item(0)->attributes AS $attributes) {
if ($attributes->name == "source") {
$item["app"] = strip_tags($attributes->textContent);
@ -2378,9 +2378,9 @@ class dfrn {
}
}
if (($term != "") AND ($scheme != "")) {
if (($term != "") && ($scheme != "")) {
$parts = explode(":", $scheme);
if ((count($parts) >= 4) AND (array_shift($parts) == "X-DFRN")) {
if ((count($parts) >= 4) && (array_shift($parts) == "X-DFRN")) {
$termhash = array_shift($parts);
$termurl = implode(":", $parts);
@ -2440,7 +2440,7 @@ class dfrn {
$item["contact-id"] = $owner["contact-id"];
}
if (($item["network"] != $owner["network"]) AND ($owner["network"] != "")) {
if (($item["network"] != $owner["network"]) && ($owner["network"] != "")) {
$item["network"] = $owner["network"];
}
@ -2448,7 +2448,7 @@ class dfrn {
$item["contact-id"] = $author["contact-id"];
}
if (($item["network"] != $author["network"]) AND ($author["network"] != "")) {
if (($item["network"] != $author["network"]) && ($author["network"] != "")) {
$item["network"] = $author["network"];
}
@ -2548,7 +2548,7 @@ class dfrn {
);
}