diff --git a/boot.php b/boot.php index 15341c0fed..6fd7c30372 100644 --- a/boot.php +++ b/boot.php @@ -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); } diff --git a/include/Contact.php b/include/Contact.php index bb6d8c1981..0aeabc9725 100644 --- a/include/Contact.php +++ b/include/Contact.php @@ -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 .= ', '; diff --git a/include/Photo.php b/include/Photo.php index 5920f80b38..5c3a52ffd5 100644 --- a/include/Photo.php +++ b/include/Photo.php @@ -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; diff --git a/include/acl_selectors.php b/include/acl_selectors.php index c7c6bb206a..665ed17bdf 100644 --- a/include/acl_selectors.php +++ b/include/acl_selectors.php @@ -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 .= "\r\n"; - if ($privmail AND $preselected) { + if ($privmail && $preselected) { $o .= implode(", ", $receiverlist); } diff --git a/include/api.php b/include/api.php index 5d962ecd03..bc40e420b0 100644 --- a/include/api.php +++ b/include/api.php @@ -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 = "