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

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