From 722782d553a2681ea70cdf9f6ea8d603b897e05e Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 3 Jan 2018 21:05:55 -0500 Subject: [PATCH] Remove unused parameter in can_write_wall() --- include/like.php | 2 +- include/security.php | 5 ++--- mod/item.php | 2 +- mod/photos.php | 8 ++++---- mod/profile.php | 2 +- mod/subthread.php | 2 +- src/Object/Thread.php | 4 ++-- 7 files changed, 12 insertions(+), 13 deletions(-) diff --git a/include/like.php b/include/like.php index 8b8759c2f6..793ea04215 100644 --- a/include/like.php +++ b/include/like.php @@ -85,7 +85,7 @@ function do_like($item_id, $verb) { $uid = local_user(); } - if (!can_write_wall($a, $uid)) { + if (!can_write_wall($uid)) { logger('like: unable to write on wall ' . $uid); return false; } diff --git a/include/security.php b/include/security.php index c443586c25..3cdfb4f28d 100644 --- a/include/security.php +++ b/include/security.php @@ -165,7 +165,7 @@ function authenticate_success($user_record, $login_initial = false, $interactive } } -function can_write_wall(App $a, $owner) +function can_write_wall($owner) { static $verified = 0; @@ -174,8 +174,7 @@ function can_write_wall(App $a, $owner) } $uid = local_user(); - - if (($uid) && ($uid == $owner)) { + if ($uid == $owner) { return true; } diff --git a/mod/item.php b/mod/item.php index 1faef96016..feb0496a36 100644 --- a/mod/item.php +++ b/mod/item.php @@ -215,7 +215,7 @@ function item_post(App $a) { * Now check that it is a page_type of PAGE_BLOG, and that valid personal details * have been provided, and run any anti-spam plugins */ - if (!(can_write_wall($a, $profile_uid) || $allow_comment) && !$allow_moderated) { + if (!(can_write_wall($profile_uid) || $allow_comment) && !$allow_moderated) { notice(t('Permission denied.') . EOL) ; if (x($_REQUEST, 'return')) { goaway($return_path); diff --git a/mod/photos.php b/mod/photos.php index 54cfd7d4f7..ab0ad75013 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -1499,7 +1499,7 @@ function photos_content(App $a) $tpl = get_markup_template('photo_item.tpl'); $return_url = $a->cmd; - if ($can_post || can_write_wall($a, $owner_uid)) { + if ($can_post || can_write_wall($owner_uid)) { $like_tpl = get_markup_template('like_noshare.tpl'); $likebuttons = replace_macros($like_tpl, array( '$id' => $link_item['id'], @@ -1511,7 +1511,7 @@ function photos_content(App $a) } if (!DBM::is_result($r)) { - if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) { + if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) { $comments .= replace_macros($cmnt_tpl, array( '$return_path' => '', '$jsreload' => $return_url, @@ -1550,7 +1550,7 @@ function photos_content(App $a) $dislike = format_like($conv_responses['dislike'][$link_item['uri']], $conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike', $link_item['id']); } - if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) { + if (($can_post || can_write_wall($owner_uid)) && $link_item['last-child']) { $comments .= replace_macros($cmnt_tpl,array( '$return_path' => '', '$jsreload' => $return_url, @@ -1623,7 +1623,7 @@ function photos_content(App $a) '$comment' => $comment )); - if (($can_post || can_write_wall($a, $owner_uid)) && $item['last-child']) { + if (($can_post || can_write_wall($owner_uid)) && $item['last-child']) { $comments .= replace_macros($cmnt_tpl, array( '$return_path' => '', '$jsreload' => $return_url, diff --git a/mod/profile.php b/mod/profile.php index bebd284030..ce2c5348d9 100644 --- a/mod/profile.php +++ b/mod/profile.php @@ -194,7 +194,7 @@ function profile_content(App $a, $update = 0) $a->page['aside'] .= categories_widget(System::baseUrl(true) . '/profile/' . $a->profile['nickname'], (x($category) ? xmlify($category) : '')); $a->page['aside'] .= tagcloud_wall_widget(); - if (can_write_wall($a, $a->profile['profile_uid'])) { + if (can_write_wall($a->profile['profile_uid'])) { $x = array( 'is_owner' => $is_owner, 'allow_location' => ($is_owner || $commvisitor) && $a->profile['allow_location'], diff --git a/mod/subthread.php b/mod/subthread.php index a597b16987..9200c335e1 100644 --- a/mod/subthread.php +++ b/mod/subthread.php @@ -32,7 +32,7 @@ function subthread_content(App $a) { $owner_uid = $item['uid']; - if(! can_write_wall($a,$owner_uid)) { + if(! can_write_wall($owner_uid)) { return; } diff --git a/src/Object/Thread.php b/src/Object/Thread.php index a03bae6e9d..534095efbb 100644 --- a/src/Object/Thread.php +++ b/src/Object/Thread.php @@ -60,11 +60,11 @@ class Thread extends BaseObject break; case 'profile': $this->profile_owner = $a->profile['profile_uid']; - $this->writable = can_write_wall($a, $this->profile_owner); + $this->writable = can_write_wall($this->profile_owner); break; case 'display': $this->profile_owner = $a->profile['uid']; - $this->writable = can_write_wall($a, $this->profile_owner) || $writable; + $this->writable = can_write_wall($this->profile_owner) || $writable; break; case 'community': $this->profile_owner = local_user();