diff options
author | Mike Macgirvin <mike@macgirvin.com> | 2010-09-26 17:24:20 -0700 |
---|---|---|
committer | Mike Macgirvin <mike@macgirvin.com> | 2010-09-26 17:24:20 -0700 |
commit | 34eedb503acad59d649f96d3250b40cc1c84047c (patch) | |
tree | 95f0eb71d4db446743f5043ce8009fcc1566d9fa /mod | |
parent | 1105cdb0654b6f9bb03e686b351da1cdaa8d8f4f (diff) | |
download | volse-hubzilla-34eedb503acad59d649f96d3250b40cc1c84047c.tar.gz volse-hubzilla-34eedb503acad59d649f96d3250b40cc1c84047c.tar.bz2 volse-hubzilla-34eedb503acad59d649f96d3250b40cc1c84047c.zip |
stronger type checking on comparisons
Diffstat (limited to 'mod')
-rw-r--r-- | mod/contacts.php | 8 | ||||
-rw-r--r-- | mod/dfrn_poll.php | 8 | ||||
-rw-r--r-- | mod/display.php | 4 | ||||
-rw-r--r-- | mod/group.php | 6 | ||||
-rw-r--r-- | mod/item.php | 8 | ||||
-rw-r--r-- | mod/like.php | 4 | ||||
-rw-r--r-- | mod/message.php | 10 | ||||
-rw-r--r-- | mod/network.php | 4 | ||||
-rw-r--r-- | mod/photos.php | 16 | ||||
-rw-r--r-- | mod/profile.php | 6 | ||||
-rw-r--r-- | mod/profiles.php | 8 | ||||
-rw-r--r-- | mod/regmod.php | 4 | ||||
-rw-r--r-- | mod/settings.php | 2 |
13 files changed, 44 insertions, 44 deletions
diff --git a/mod/contacts.php b/mod/contacts.php index 6541c1c0a..50cc1586a 100644 --- a/mod/contacts.php +++ b/mod/contacts.php @@ -98,7 +98,7 @@ function contacts_content(&$a) { } - if($cmd == 'block') { + if($cmd === 'block') { $blocked = (($orig_record[0]['blocked']) ? 0 : 1); $r = q("UPDATE `contact` SET `blocked` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($blocked), @@ -112,7 +112,7 @@ function contacts_content(&$a) { return; // NOTREACHED } - if($cmd == 'ignore') { + if($cmd === 'ignore') { $readonly = (($orig_record[0]['readonly']) ? 0 : 1); $r = q("UPDATE `contact` SET `readonly` = %d WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($readonly), @@ -126,7 +126,7 @@ function contacts_content(&$a) { return; // NOTREACHED } - if($cmd == 'drop') { + if($cmd === 'drop') { contact_remove($contact_id); notice( t('Contact has been removed.') . EOL ); goaway($a->get_baseurl() . '/contacts'); @@ -195,7 +195,7 @@ function contacts_content(&$a) { } - if(($a->argc == 2) && ($a->argv[1] == 'all')) + if(($a->argc == 2) && ($a->argv[1] === 'all')) $sql_extra = ''; else $sql_extra = " AND `blocked` = 0 "; diff --git a/mod/dfrn_poll.php b/mod/dfrn_poll.php index a85351c8c..a65f6555d 100644 --- a/mod/dfrn_poll.php +++ b/mod/dfrn_poll.php @@ -26,13 +26,13 @@ function dfrn_poll_init(&$a) { $dfrn_id = substr($dfrn_id,2); } - if(($dfrn_id == '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) { + if(($dfrn_id === '') && (! x($_POST,'dfrn_id')) && ($a->argc > 1)) { $o = get_feed_for($a, '*', $a->argv[1],$last_update); echo $o; killme(); } - if((x($type)) && ($type == 'profile')) { + if((x($type)) && ($type === 'profile')) { $sql_extra = ''; switch($direction) { @@ -85,7 +85,7 @@ function dfrn_poll_init(&$a) { } - if((x($type)) && ($type == 'profile-check')) { + if((x($type)) && ($type === 'profile-check')) { switch($direction) { case 1: @@ -173,7 +173,7 @@ function dfrn_poll_post(&$a) { $contact_id = $r[0]['id']; - if($type == 'reputation' && strlen($url)) { + if($type === 'reputation' && strlen($url)) { $r = q("SELECT * FROM `contact` WHERE `url` = '%s' AND `uid` = %d LIMIT 1", dbesc($url), intval($owner_uid) diff --git a/mod/display.php b/mod/display.php index 5c4c5b12b..f695dc205 100644 --- a/mod/display.php +++ b/mod/display.php @@ -173,7 +173,7 @@ function display_content(&$a) { if(($item['parent'] == $item['item_id']) && (! $item['self'])) { - if($item['type'] == 'wall') { + if($item['type'] === 'wall') { // I do. Put me on the left of the wall-to-wall notice. $owner_url = $a->contact['url']; $owner_photo = $a->contact['thumb']; @@ -181,7 +181,7 @@ function display_content(&$a) { $template = $wallwall; $commentww = 'ww'; } - if($item['type'] == 'remote' && ($item['owner-link'] != $item['author-link'])) { + if($item['type'] === 'remote' && ($item['owner-link'] != $item['author-link'])) { // Could be anybody. $owner_url = $item['owner-link']; $owner_photo = $item['owner-avatar']; diff --git a/mod/group.php b/mod/group.php index aa4751961..dc5dd3c71 100644 --- a/mod/group.php +++ b/mod/group.php @@ -20,7 +20,7 @@ function group_post(&$a) { return; } - if(($a->argc == 2) && ($a->argv[1] == 'new')) { + if(($a->argc == 2) && ($a->argv[1] === 'new')) { $name = notags(trim($_POST['groupname'])); $r = group_add(get_uid(),$name); if($r) { @@ -88,13 +88,13 @@ function group_content(&$a) { return; } - if(($a->argc == 2) && ($a->argv[1] == 'new')) { + if(($a->argc == 2) && ($a->argv[1] === 'new')) { $tpl = load_view_file('view/group_new.tpl'); $o .= replace_macros($tpl,array()); return $o; } - if(($a->argc == 3) && ($a->argv[1] == 'drop')) { + if(($a->argc == 3) && ($a->argv[1] === 'drop')) { if(intval($a->argv[2])) { $r = q("SELECT `name` FROM `group` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), diff --git a/mod/item.php b/mod/item.php index 922a407ef..fb2bff127 100644 --- a/mod/item.php +++ b/mod/item.php @@ -95,9 +95,9 @@ function item_post(&$a) { $post_type = notags(trim($_POST['type'])); - if($post_type == 'net-comment') { + if($post_type === 'net-comment') { if($parent_item !== null) { - if($parent_item['type'] == 'remote') { + if($parent_item['type'] === 'remote') { $post_type = 'remote-comment'; } else { @@ -107,7 +107,7 @@ function item_post(&$a) { } $wall = 0; - if($post_type == 'wall' || $post_type == 'wall-comment') + if($post_type === 'wall' || $post_type === 'wall-comment') $wall = 1; if(! strlen($verb)) @@ -244,7 +244,7 @@ function item_content(&$a) { $uid = $_SESSION['uid']; - if(($a->argc == 3) && ($a->argv[1] == 'drop') && intval($a->argv[2])) { + if(($a->argc == 3) && ($a->argv[1] === 'drop') && intval($a->argv[2])) { // locate item to be deleted diff --git a/mod/like.php b/mod/like.php index 10a466b50..c7782d4d7 100644 --- a/mod/like.php +++ b/mod/like.php @@ -121,9 +121,9 @@ function like_content(&$a) { <content>$body</content> </object> EOT; - if($verb == 'like') + if($verb === 'like') $bodyverb = t('likes'); - if($verb == 'dislike') + if($verb === 'dislike') $bodyverb = t('doesn\'t like'); if(! isset($bodyverb)) diff --git a/mod/message.php b/mod/message.php index a16b0d8cf..b544b552a 100644 --- a/mod/message.php +++ b/mod/message.php @@ -103,11 +103,11 @@ function message_content(&$a) { )); - if(($a->argc == 3) && ($a->argv[1] == 'drop' || $a->argv[1] == 'dropconv')) { + if(($a->argc == 3) && ($a->argv[1] === 'drop' || $a->argv[1] === 'dropconv')) { if(! intval($a->argv[2])) return; $cmd = $a->argv[1]; - if($cmd == 'drop') { + if($cmd === 'drop') { $r = q("DELETE FROM `mail` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[2]), intval($_SESSION['uid']) @@ -135,7 +135,7 @@ function message_content(&$a) { } } - if(($a->argc > 2) && ($a->argv[1] == 'redeliver') && intval($a->argv[2])) { + if(($a->argc > 2) && ($a->argv[1] === 'redeliver') && intval($a->argv[2])) { $post_id = intval($a->argv[2]); $php_path = ((strlen($a->config['php_path'])) ? $a->config['php_path'] : 'php'); $proc_debug = get_config('system','proc_debug'); @@ -148,7 +148,7 @@ function message_content(&$a) { - if(($a->argc > 1) && ($a->argv[1] == 'new')) { + if(($a->argc > 1) && ($a->argv[1] === 'new')) { $tpl = load_view_file('view/msg-header.tpl'); @@ -174,7 +174,7 @@ function message_content(&$a) { return $o; } - if(($a->argc == 1) || ($a->argc == 2 && $a->argv[1] == 'sent')) { + if(($a->argc == 1) || ($a->argc == 2 && $a->argv[1] === 'sent')) { $o .= $header; diff --git a/mod/network.php b/mod/network.php index fa267fee2..541e10494 100644 --- a/mod/network.php +++ b/mod/network.php @@ -172,7 +172,7 @@ function network_content(&$a, $update = 0) { if(($item['parent'] == $item['item_id']) && (! $item['self'])) { - if($item['type'] == 'wall') { + if($item['type'] === 'wall') { // I do. Put me on the left of the wall-to-wall notice. $owner_url = $a->contact['url']; $owner_photo = $a->contact['thumb']; @@ -180,7 +180,7 @@ function network_content(&$a, $update = 0) { $template = $wallwall; $commentww = 'ww'; } - if($item['type'] == 'remote' && ($item['owner-link'] != $item['author-link'])) { + if($item['type'] === 'remote' && ($item['owner-link'] != $item['author-link'])) { // Could be anybody. $owner_url = $item['owner-link']; $owner_photo = $item['owner-avatar']; diff --git a/mod/photos.php b/mod/photos.php index 705c76200..693d068e4 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -61,7 +61,7 @@ function photos_post(&$a) { $contact_record = $r[0]; - if(($a->argc > 2) && ($a->argv[1] == 'album')) { + if(($a->argc > 2) && ($a->argv[1] === 'album')) { $album = hex2bin($a->argv[2]); if($album == t('Profile Photos') || $album == t('Contact Photos')) { @@ -390,7 +390,7 @@ function photos_content(&$a) { $datatype = $a->argv[2]; $datum = $a->argv[3]; } - elseif(($a->argc > 2) && ($a->argv[2] == 'upload')) + elseif(($a->argc > 2) && ($a->argv[2] === 'upload')) $datatype = 'upload'; else $datatype = 'summary'; @@ -445,7 +445,7 @@ function photos_content(&$a) { // - if($datatype == 'upload') { + if($datatype === 'upload') { if( ! (local_user() && (get_uid() == $a->data['user']['uid']))) { notice( t('Permission denied.')); return; @@ -455,7 +455,7 @@ function photos_content(&$a) { $albumselect .= '<option value="" selected="selected" > </option>'; if(count($a->data['albums'])) { foreach($a->data['albums'] as $album) { - if(($album['album'] == '') || ($album['album'] == t('Contact Photos'))) + if(($album['album'] === '') || ($album['album'] == t('Contact Photos'))) continue; $albumselect .= '<option value="' . $album['album'] . '">' . $album['album'] . '</option>'; } @@ -481,7 +481,7 @@ function photos_content(&$a) { } - if($datatype == 'album') { + if($datatype === 'album') { $album = hex2bin($datum); @@ -504,7 +504,7 @@ function photos_content(&$a) { $o .= '<h3>' . $album . '</h3>'; - if($cmd == 'edit') { + if($cmd === 'edit') { if(($album != t('Profile Photos')) && ($album != t('Contact Photos'))) { if(local_user() && (get_uid() == $a->data['user']['uid'])) { $edit_tpl = load_view_file('view/album_edit.tpl'); @@ -545,7 +545,7 @@ function photos_content(&$a) { } - if($datatype == 'image') { + if($datatype === 'image') { require_once('security.php'); require_once('bbcode.php'); @@ -638,7 +638,7 @@ function photos_content(&$a) { $o .= '<div id="in-this-photo">' . $i1[0]['tag'] . '</div>'; } - if($cmd == 'edit') { + if($cmd === 'edit') { $edit_tpl = load_view_file('view/photo_edit.tpl'); $o .= replace_macros($edit_tpl, array( '$id' => $ph[0]['id'], diff --git a/mod/profile.php b/mod/profile.php index 8c23b6c57..8395bc1f6 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -56,7 +56,7 @@ function profile_init(&$a) { } $profile = 0; - if((local_user()) && ($a->argc > 2) && ($a->argv[2] == 'view')) { + if((local_user()) && ($a->argc > 2) && ($a->argv[2] === 'view')) { $which = $a->user['nickname']; $profile = $a->argv[1]; } @@ -129,7 +129,7 @@ function profile_content(&$a, $update = 0) { )); - if($tab == 'profile') { + if($tab === 'profile') { $lang = get_config('system','language'); if($lang && file_exists("view/$lang/profile_advanced.php")) require_once("view/$lang/profile_advanced.php"); @@ -164,7 +164,7 @@ function profile_content(&$a, $update = 0) { // This is ugly, but we can't pass the profile_uid through the session to the ajax updater, // because browser prefetching might change it on us. We have to deliver it with the page. - if($tab == 'posts' && (! $a->pager['start'])) { + if($tab === 'posts' && (! $a->pager['start'])) { $o .= '<div id="live-profile"></div>' . "\r\n"; $o .= "<script> var profile_uid = " . $a->profile['profile_uid'] . "; </script>\r\n"; } diff --git a/mod/profiles.php b/mod/profiles.php index 111610c66..ce7e616ea 100644 --- a/mod/profiles.php +++ b/mod/profiles.php @@ -10,7 +10,7 @@ function profiles_post(&$a) { $namechanged = false; - if(($a->argc > 1) && ($a->argv[1] != "new") && intval($a->argv[1])) { + if(($a->argc > 1) && ($a->argv[1] !== "new") && intval($a->argv[1])) { $orig = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d LIMIT 1", intval($a->argv[1]), intval($_SESSION['uid']) @@ -163,7 +163,7 @@ function profiles_content(&$a) { return; } - if(($a->argc > 2) && ($a->argv[1] == "drop") && intval($a->argv[2])) { + if(($a->argc > 2) && ($a->argv[1] === "drop") && intval($a->argv[2])) { $r = q("SELECT * FROM `profile` WHERE `id` = %d AND `uid` = %d AND `is-default` = 0 AND `self` = 0 LIMIT 1", intval($a->argv[2]), intval($_SESSION['uid']) @@ -195,7 +195,7 @@ function profiles_content(&$a) { - if(($a->argc > 1) && ($a->argv[1] == 'new')) { + if(($a->argc > 1) && ($a->argv[1] === 'new')) { $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", intval($_SESSION['uid'])); @@ -225,7 +225,7 @@ function profiles_content(&$a) { goaway($a->get_baseurl() . '/profiles'); } - if(($a->argc > 2) && ($a->argv[1] == 'clone')) { + if(($a->argc > 2) && ($a->argv[1] === 'clone')) { $r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d", intval($_SESSION['uid'])); diff --git a/mod/regmod.php b/mod/regmod.php index 373180ba2..49a719493 100644 --- a/mod/regmod.php +++ b/mod/regmod.php @@ -29,7 +29,7 @@ function regmod_content(&$a) { intval($register[0]['uid']) ); - if($cmd == 'deny') { + if($cmd === 'deny') { $r = q("DELETE FROM `user` WHERE `uid` = %d LIMIT 1", intval($register[0]['uid']) @@ -49,7 +49,7 @@ function regmod_content(&$a) { } - if($cmd == 'allow') { + if($cmd === 'allow') { if(! count($user)) killme(); diff --git a/mod/settings.php b/mod/settings.php index aef00c8c2..7ba2f177f 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -215,7 +215,7 @@ function settings_content(&$a) { if($files) { foreach($files as $file) { $f = basename($file); - $selected = (($f == $_SESSION['theme']) || ($f == 'default' && (! x($_SESSION,'theme'))) + $selected = (($f == $_SESSION['theme']) || ($f === 'default' && (! x($_SESSION,'theme'))) ? ' selected="selected" ' : '' ); $theme_selector .= '<option val="' . basename($file) . '"' . $selected . '>' . basename($file) . '</option>'; } |