added more curly braces/spaces

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-03-24 22:33:57 +01:00
parent daa32d49cf
commit be717649a4
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78
1 changed files with 32 additions and 28 deletions

View File

@ -176,7 +176,7 @@ function profiles_post(App $a) {
intval($a->argv[1]),
intval(local_user())
);
if(! count($orig)) {
if (! dbm::is_result($orig)) {
notice( t('Profile not found.') . EOL);
return;
}
@ -194,19 +194,22 @@ function profiles_post(App $a) {
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$y = substr($dob,0,4);
if((! ctype_digit($y)) || ($y < 1900))
if ((! ctype_digit($y)) || ($y < 1900)) {
$ignore_year = true;
else
} else {
$ignore_year = false;
}
if ($dob != '0000-00-00') {
if (strpos($dob,'0000-') === 0) {
$ignore_year = true;
$dob = substr($dob, 5);
}
$dob = datetime_convert('UTC', 'UTC', (($ignore_year) ? '1900-' . $dob : $dob), (($ignore_year) ? 'm-d' : 'Y-m-d'));
if($ignore_year)
if ($ignore_year) {
$dob = '0000-' . $dob;
}
}
$name = notags(trim($_POST['name']));
@ -214,10 +217,9 @@ function profiles_post(App $a) {
$name = '[No Name]';
}
if($orig[0]['name'] != $name)
if ($orig[0]['name'] != $name) {
$namechanged = true;
}
$pdesc = notags(trim($_POST['pdesc']));
$gender = notags(trim($_POST['gender']));
@ -247,8 +249,9 @@ function profiles_post(App $a) {
$withchanged = true;
$prf = '';
$lookup = $with;
if(strpos($lookup,'@') === 0)
if (strpos($lookup,'@') === 0) {
$lookup = substr($lookup, 1);
}
$lookup = str_replace('_',' ', $lookup);
if (strpos($lookup, '@') || (strpos($lookup, 'http://'))) {
$newname = $lookup;
@ -285,11 +288,12 @@ function profiles_post(App $a) {
$with = substr($with, 1);
}
}
}
else
} else {
$with = $orig[0]['with'];
}
}
/// @TODO Not flexible enough for later expansion, let's have more OOP here
$sexual = notags(trim($_POST['sexual']));
$xmpp = notags(trim($_POST['xmpp']));
$homepage = notags(trim($_POST['homepage']));