Continued:
- used dbm::is_result() to avoid E_WARNING when false is returned - added curly braces + some spaces Signed-off-by: Roland Haeder <roland@mxchange.org>pull/3254/head
parent
e503141b0c
commit
177a0c8320
|
@ -34,24 +34,22 @@ function profiles_init(App $a) {
|
|||
intval($a->argv[2]),
|
||||
intval(local_user())
|
||||
);
|
||||
if($r)
|
||||
if (dbm::is_result($r)) {
|
||||
info(t('Profile deleted.').EOL);
|
||||
}
|
||||
|
||||
goaway('profiles');
|
||||
return; // NOTREACHED
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if (($a->argc > 1) && ($a->argv[1] === 'new')) {
|
||||
|
||||
check_form_security_token_redirectOnErr('/profiles', 'profile_new', 't');
|
||||
|
||||
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
|
||||
intval(local_user()));
|
||||
$num_profiles = count($r0);
|
||||
|
||||
$num_profiles = (dbm::is_result($r0) ? count($r0) : 0);
|
||||
|
||||
$name = t('Profile-') . ($num_profiles + 1);
|
||||
|
||||
|
@ -73,8 +71,9 @@ function profiles_init(App $a) {
|
|||
);
|
||||
|
||||
info( t('New profile created.') . EOL);
|
||||
if(count($r3) == 1)
|
||||
if (dbm::is_result($r3) && count($r3) == 1) {
|
||||
goaway('profiles/' . $r3[0]['id']);
|
||||
}
|
||||
|
||||
goaway('profiles');
|
||||
}
|
||||
|
@ -85,7 +84,8 @@ function profiles_init(App $a) {
|
|||
|
||||
$r0 = q("SELECT `id` FROM `profile` WHERE `uid` = %d",
|
||||
intval(local_user()));
|
||||
$num_profiles = count($r0);
|
||||
|
||||
$num_profiles = (dbm::is_result($r0) ? count($r0) : 0);
|
||||
|
||||
$name = t('Profile-') . ($num_profiles + 1);
|
||||
$r1 = q("SELECT * FROM `profile` WHERE `uid` = %d AND `id` = %d LIMIT 1",
|
||||
|
@ -116,8 +116,9 @@ function profiles_init(App $a) {
|
|||
dbesc($name)
|
||||
);
|
||||
info( t('New profile created.') . EOL);
|
||||
if ((dbm::is_result($r3)) && (count($r3) == 1))
|
||||
if ((dbm::is_result($r3)) && (count($r3) == 1)) {
|
||||
goaway('profiles/'.$r3[0]['id']);
|
||||
}
|
||||
|
||||
goaway('profiles');
|
||||
|
||||
|
@ -151,9 +152,10 @@ function profile_clean_keywords($keywords) {
|
|||
foreach ($keywords as $keyword) {
|
||||
$keyword = trim(strtolower($keyword));
|
||||
$keyword = trim($keyword, "#");
|
||||
if ($keyword != "")
|
||||
if ($keyword != "") {
|
||||
$cleaned[] = $keyword;
|
||||
}
|
||||
}
|
||||
|
||||
$keywords = implode(", ", $cleaned);
|
||||
|
||||
|
|
Loading…
Reference in New Issue