From 34eedb503acad59d649f96d3250b40cc1c84047c Mon Sep 17 00:00:00 2001 From: Mike Macgirvin Date: Sun, 26 Sep 2010 17:24:20 -0700 Subject: stronger type checking on comparisons --- include/auth.php | 6 +++--- include/items.php | 10 +++++----- include/notifier.php | 8 ++++---- include/poller.php | 4 ++-- 4 files changed, 14 insertions(+), 14 deletions(-) (limited to 'include') diff --git a/include/auth.php b/include/auth.php index b856379f1..6a50362d6 100644 --- a/include/auth.php +++ b/include/auth.php @@ -2,8 +2,8 @@ // login/logout -if((x($_SESSION,'authenticated')) && (! ($_POST['auth-params'] == 'login'))) { - if($_POST['auth-params'] == 'logout' || $a->module == "logout") { +if((x($_SESSION,'authenticated')) && (! ($_POST['auth-params'] === 'login'))) { + if($_POST['auth-params'] === 'logout' || $a->module === 'logout') { unset($_SESSION['authenticated']); unset($_SESSION['uid']); unset($_SESSION['visitor_id']); @@ -46,7 +46,7 @@ else { $encrypted = hash('whirlpool',trim($_POST['password'])); - if((x($_POST,'auth-params')) && $_POST['auth-params'] == 'login') { + if((x($_POST,'auth-params')) && $_POST['auth-params'] === 'login') { $r = q("SELECT * FROM `user` WHERE `email` = '%s' AND `password` = '%s' AND `blocked` = 0 AND `verified` = 1 LIMIT 1", dbesc(trim($_POST['login-name'])), diff --git a/include/items.php b/include/items.php index ea95c4f1d..a44bc1feb 100644 --- a/include/items.php +++ b/include/items.php @@ -84,7 +84,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { ); } - if($dfrn_id == '' || $dfrn_id == '*') + if($dfrn_id === '' || $dfrn_id === '*') $sort = 'DESC'; else $sort = 'ASC'; @@ -147,7 +147,7 @@ function get_feed_for(&$a, $dfrn_id, $owner_id, $last_update, $direction = 0) { // public feeds get html, our own nodes use bbcode - if($dfrn_id == '*') { + if($dfrn_id === '*') { $item['body'] = bbcode($item['body']); $type = 'html'; } @@ -250,7 +250,7 @@ function get_atom_elements($item) { $raw_author = $item->get_item_tags(SIMPLEPIE_NAMESPACE_ATOM_10,'author'); if($raw_author) { - if($raw_author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['rel'] == 'photo') + if($raw_author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['rel'] === 'photo') $res['author-avatar'] = unxmlify($raw_author[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['href']); } @@ -327,7 +327,7 @@ function get_atom_elements($item) { elseif($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']) $res['owner-link'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['uri'][0]['data']); - if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['rel'] == 'photo') + if($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['rel'] === 'photo') $res['owner-avatar'] = unxmlify($rawowner[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['href']); elseif($rawowner[0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']) $res['owner-avatar'] = unxmlify($rawowner[0]['child'][NAMESPACE_DFRN]['avatar'][0]['data']); @@ -349,7 +349,7 @@ function get_atom_elements($item) { if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data']) $res['object'] .= '' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['id'][0]['data'] . '' . "\n"; - if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['rel'] == 'alternate') + if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['rel'] === 'alternate') $res['object'] .= '' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['link'][0]['attribs']['']['href'] . '' . "\n"; if($rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data']) $res['object'] .= '' . $rawobj[0]['child'][SIMPLEPIE_NAMESPACE_ATOM_10]['title'][0]['data'] . '' . "\n"; diff --git a/include/notifier.php b/include/notifier.php index 571677aa3..2124c18e7 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -39,7 +39,7 @@ $recipients = array(); - if($cmd == 'mail') { + if($cmd === 'mail') { $message = q("SELECT * FROM `mail` WHERE `id` = %d LIMIT 1", intval($item_id) @@ -89,7 +89,7 @@ $parent = $items[0]; - if($parent['type'] == 'remote') { + if($parent['type'] === 'remote') { // local followup to remote post $followup = true; $conversant_str = dbesc($parent['contact-id']); @@ -152,7 +152,7 @@ '$namdate' => xmlify(datetime_convert('UTC','UTC',$owner['name-date'] . '+00:00' , ATOM_TIME)) )); - if($cmd == 'mail') { + if($cmd === 'mail') { $atom .= replace_macros($mail_template, array( '$name' => xmlify($owner['name']), '$profile_page' => xmlify($owner['url']), @@ -287,7 +287,7 @@ break; } - if(($cmd == 'mail') && ($deliver_status == 0)) { + if(($cmd === 'mail') && ($deliver_status == 0)) { $r = q("UPDATE `mail` SET `delivered` = 1 WHERE `id` = %d LIMIT 1", intval($item_id) ); diff --git a/include/poller.php b/include/poller.php index f35d1c7b0..6b0719b92 100644 --- a/include/poller.php +++ b/include/poller.php @@ -75,7 +75,7 @@ if($debugging) echo "IMPORTER: {$importer['name']}"; - $last_update = (($contact['last-update'] == '0000-00-00 00:00:00') + $last_update = (($contact['last-update'] === '0000-00-00 00:00:00') ? datetime_convert('UTC','UTC','now - 30 days','Y-m-d\TH:i:s\Z') : datetime_convert('UTC','UTC',$contact['last-update'],'Y-m-d\TH:i:s\Z')); @@ -179,7 +179,7 @@ $name_updated = $elems['name'][0]['attribs'][NAMESPACE_DFRN]['updated']; $new_name = $elems['name'][0]['data']; } - if(($elems['link'][0]['attribs']['']['rel'] == 'photo') && ($elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated'])) { + if(($elems['link'][0]['attribs']['']['rel'] === 'photo') && ($elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated'])) { $photo_timestamp = datetime_convert('UTC','UTC',$elems['link'][0]['attribs'][NAMESPACE_DFRN]['updated']); $photo_url = $elems['link'][0]['attribs']['']['href']; } -- cgit v1.2.3