From 192f6d7cf43be08b5ac873d0bfbd84494eef3e2f Mon Sep 17 00:00:00 2001
From: Roland Haeder <roland@mxchange.org>
Date: Thu, 30 Mar 2017 21:48:46 +0200
Subject: [PATCH] merged 2 if() into one three times

Signed-off-by: Roland Haeder <roland@mxchange.org>
---
 mod/photos.php | 117 +++++++++++++++++++++++--------------------------
 1 file changed, 54 insertions(+), 63 deletions(-)

diff --git a/mod/photos.php b/mod/photos.php
index 92682f4437..0f021d55a8 100644
--- a/mod/photos.php
+++ b/mod/photos.php
@@ -1628,27 +1628,24 @@ function photos_content(App $a) {
 
 			$comments = '';
 			if (! dbm::is_result($r)) {
-				/// @TODO merge into one if() ?
-				if ($can_post || can_write_wall($a,$owner_uid)) {
-					if ($link_item['last-child']) {
-						$comments .= replace_macros($cmnt_tpl,array(
-							'$return_path' => '',
-							'$jsreload' => $return_url,
-							'$type' => 'wall-comment',
-							'$id' => $link_item['id'],
-							'$parent' => $link_item['id'],
-							'$profile_uid' =>  $owner_uid,
-							'$mylink' => $contact['url'],
-							'$mytitle' => t('This is you'),
-							'$myphoto' => $contact['thumb'],
-							'$comment' => t('Comment'),
-							'$submit' => t('Submit'),
-							'$preview' => t('Preview'),
-							'$sourceapp' => t($a->sourcename),
-							'$ww' => '',
-							'$rand_num' => random_digits(12)
-						));
-					}
+				if (($can_post || can_write_wall($a,$owner_uid)) && $link_item['last-child']) {
+					$comments .= replace_macros($cmnt_tpl,array(
+						'$return_path' => '',
+						'$jsreload' => $return_url,
+						'$type' => 'wall-comment',
+						'$id' => $link_item['id'],
+						'$parent' => $link_item['id'],
+						'$profile_uid' =>  $owner_uid,
+						'$mylink' => $contact['url'],
+						'$mytitle' => t('This is you'),
+						'$myphoto' => $contact['thumb'],
+						'$comment' => t('Comment'),
+						'$submit' => t('Submit'),
+						'$preview' => t('Preview'),
+						'$sourceapp' => t($a->sourcename),
+						'$ww' => '',
+						'$rand_num' => random_digits(12)
+					));
 				}
 			}
 
@@ -1673,27 +1670,24 @@ function photos_content(App $a) {
 				$like    = ((x($conv_responses['like'],$link_item['uri'])) ? format_like($conv_responses['like'][$link_item['uri']],$conv_responses['like'][$link_item['uri'] . '-l'], 'like',$link_item['id']) : '');
 				$dislike = ((x($conv_responses['dislike'],$link_item['uri'])) ? format_like($conv_responses['dislike'][$link_item['uri']],$conv_responses['dislike'][$link_item['uri'] . '-l'], 'dislike',$link_item['id']) : '');
 
-				/// @TODO merge into one if() ?
-				if ($can_post || can_write_wall($a,$owner_uid)) {
-					if ($link_item['last-child']) {
-						$comments .= replace_macros($cmnt_tpl,array(
-							'$return_path' => '',
-							'$jsreload' => $return_url,
-							'$type' => 'wall-comment',
-							'$id' => $link_item['id'],
-							'$parent' => $link_item['id'],
-							'$profile_uid' =>  $owner_uid,
-							'$mylink' => $contact['url'],
-							'$mytitle' => t('This is you'),
-							'$myphoto' => $contact['thumb'],
-							'$comment' => t('Comment'),
-							'$submit' => t('Submit'),
-							'$preview' => t('Preview'),
-							'$sourceapp' => t($a->sourcename),
-							'$ww' => '',
-							'$rand_num' => random_digits(12)
-						));
-					}
+				if (($can_post || can_write_wall($a, $owner_uid)) && $link_item['last-child']) {
+					$comments .= replace_macros($cmnt_tpl,array(
+						'$return_path' => '',
+						'$jsreload' => $return_url,
+						'$type' => 'wall-comment',
+						'$id' => $link_item['id'],
+						'$parent' => $link_item['id'],
+						'$profile_uid' =>  $owner_uid,
+						'$mylink' => $contact['url'],
+						'$mytitle' => t('This is you'),
+						'$myphoto' => $contact['thumb'],
+						'$comment' => t('Comment'),
+						'$submit' => t('Submit'),
+						'$preview' => t('Preview'),
+						'$sourceapp' => t($a->sourcename),
+						'$ww' => '',
+						'$rand_num' => random_digits(12)
+					));
 				}
 
 
@@ -1756,27 +1750,24 @@ function photos_content(App $a) {
 						'$comment' => $comment
 					));
 
-					/// @TODO merge into one if() ?
-					if ($can_post || can_write_wall($a, $owner_uid)) {
-						if ($item['last-child']) {
-							$comments .= replace_macros($cmnt_tpl, array(
-								'$return_path' => '',
-								'$jsreload' => $return_url,
-								'$type' => 'wall-comment',
-								'$id' => $item['item_id'],
-								'$parent' => $item['parent'],
-								'$profile_uid' =>  $owner_uid,
-								'$mylink' => $contact['url'],
-								'$mytitle' => t('This is you'),
-								'$myphoto' => $contact['thumb'],
-								'$comment' => t('Comment'),
-								'$submit' => t('Submit'),
-								'$preview' => t('Preview'),
-								'$sourceapp' => t($a->sourcename),
-								'$ww' => '',
-								'$rand_num' => random_digits(12)
-							));
-						}
+					if (($can_post || can_write_wall($a, $owner_uid)) && $item['last-child']) {
+						$comments .= replace_macros($cmnt_tpl, array(
+							'$return_path' => '',
+							'$jsreload' => $return_url,
+							'$type' => 'wall-comment',
+							'$id' => $item['item_id'],
+							'$parent' => $item['parent'],
+							'$profile_uid' =>  $owner_uid,
+							'$mylink' => $contact['url'],
+							'$mytitle' => t('This is you'),
+							'$myphoto' => $contact['thumb'],
+							'$comment' => t('Comment'),
+							'$submit' => t('Submit'),
+							'$preview' => t('Preview'),
+							'$sourceapp' => t($a->sourcename),
+							'$ww' => '',
+							'$rand_num' => random_digits(12)
+						));
 					}
 				}
 			}