added more curly braces + spaces for #3254

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-03-23 23:05:53 +01:00
parent 2470930902
commit c4b82133e9
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78
1 changed files with 51 additions and 58 deletions

View File

@ -260,26 +260,14 @@ function profiles_post(App $a) {
}
}
}
}
else {
$newname = $lookup;
/* if (strstr($lookup,' ')) {
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval(local_user())
);
} else {
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
dbesc($lookup),
intval(local_user())
);
}*/
$newname = $lookup;
$r = q("SELECT * FROM `contact` WHERE `name` = '%s' AND `uid` = %d LIMIT 1",
dbesc($newname),
intval(local_user())
);
if(! $r) {
if (! dbm::is_result($r)) {
$r = q("SELECT * FROM `contact` WHERE `nick` = '%s' AND `uid` = %d LIMIT 1",
dbesc($lookup),
intval(local_user())
@ -293,10 +281,11 @@ function profiles_post(App $a) {
if ($prf) {
$with = str_replace($lookup,'<a href="' . $prf . '">' . $newname . '</a>', $with);
if(strpos($with,'@') === 0)
if (strpos($with,'@') === 0) {
$with = substr($with, 1);
}
}
}
else
$with = $orig[0]['with'];
}
@ -472,8 +461,10 @@ function profiles_post(App $a) {
intval(local_user())
);
if($r)
/// @TODO decide to use dbm::is_result() here and check $r
if ($r) {
info( t('Profile updated.') . EOL);
}
if ($namechanged && $is_default) {
@ -518,14 +509,17 @@ function profiles_post(App $a) {
function profile_activity($changed, $value) {
$a = get_app();
if(! local_user() || ! is_array($changed) || ! count($changed))
if (! local_user() || ! is_array($changed) || ! count($changed)) {
return;
}
if($a->user['hidewall'] || get_config('system','block_public'))
if ($a->user['hidewall'] || get_config('system','block_public')) {
return;
}
if(! get_pconfig(local_user(),'system','post_profilechange'))
if (! get_pconfig(local_user(),'system','post_profilechange')) {
return;
}
require_once('include/items.php');
@ -533,8 +527,9 @@ function profile_activity($changed, $value) {
intval(local_user())
);
if(! count($self))
if (! dbm::is_result($self)) {
return;
}
$arr = array();
@ -560,11 +555,12 @@ function profile_activity($changed, $value) {
$z = 0;
foreach ($changed as $ch) {
if (strlen($changes)) {
if ($z == ($t - 1))
if ($z == ($t - 1)) {
$changes .= t(' and ');
else
} else {
$changes .= ', ';
}
}
$z ++;
$changes .= $ch;
}
@ -574,9 +570,9 @@ function profile_activity($changed, $value) {
if ($t == 1 && strlen($value)) {
$message = sprintf( t('%1$s changed %2$s to &ldquo;%3$s&rdquo;'), $A, $changes, $value);
$message .= "\n\n" . sprintf( t(' - Visit %1$s\'s %2$s'), $A, $prof);
}
else
} else {
$message = sprintf( t('%1$s has an updated %2$s, changing %3$s.'), $A, $prof, $changes);
}
$arr['body'] = $message;
@ -747,15 +743,11 @@ function profiles_content(App $a) {
call_hooks('profile_edit', $arr);
return $o;
}
//Profiles list.
else {
} else {
// If we don't support multi profiles, don't display this list.
if (!feature_enabled(local_user(),'multi_profiles')){
$r = q(
"SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
$r = q("SELECT * FROM `profile` WHERE `uid` = %d AND `is-default`=1",
local_user()
);
if (dbm::is_result($r)){
@ -766,6 +758,7 @@ function profiles_content(App $a) {
$r = q("SELECT * FROM `profile` WHERE `uid` = %d",
local_user());
if (dbm::is_result($r)) {
$tpl = get_markup_template('profile_entry.tpl');