Continued:

- added curly braces/spaces
- changed lower-case SQL keywords to upper-case
- used dbm::is_result() instead of count() (avoids warning in case of false is
  returned)

Signed-off-by: Roland Haeder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-03-25 13:14:50 +01:00
parent c1287df655
commit 67707247c8
No known key found for this signature in database
GPG Key ID: B72F8185C6C7BD78
1 changed files with 12 additions and 11 deletions

View File

@ -22,34 +22,34 @@ function manage_post(App $a) {
} }
} }
$r = q("select * from manage where uid = %d", $r = q("SELECT * FROM `manage` WHERE `uid` = %d",
intval($uid) intval($uid)
); );
$submanage = $r; $submanage = $r;
$identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0); $identity = ((x($_POST['identity'])) ? intval($_POST['identity']) : 0);
if(! $identity) if (! $identity) {
return; return;
}
$limited_id = 0; $limited_id = 0;
$original_id = $uid; $original_id = $uid;
if(count($submanage)) { if (dbm::is_result($submanage)) {
foreach($submanage as $m) { foreach ($submanage as $m) {
if($identity == $m['mid']) { if ($identity == $m['mid']) {
$limited_id = $m['mid']; $limited_id = $m['mid'];
break; break;
} }
} }
} }
if($limited_id) { if ($limited_id) {
$r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d LIMIT 1",
intval($limited_id) intval($limited_id)
); );
} } else {
else {
$r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1", $r = q("SELECT * FROM `user` WHERE `uid` = %d AND `email` = '%s' AND `password` = '%s' LIMIT 1",
intval($identity), intval($identity),
dbesc($orig_record['email']), dbesc($orig_record['email']),
@ -70,12 +70,13 @@ function manage_post(App $a) {
unset($_SESSION['mobile-theme']); unset($_SESSION['mobile-theme']);
unset($_SESSION['page_flags']); unset($_SESSION['page_flags']);
unset($_SESSION['return_url']); unset($_SESSION['return_url']);
if(x($_SESSION,'submanage')) if (x($_SESSION, 'submanage')) {
unset($_SESSION['submanage']); unset($_SESSION['submanage']);
if (x($_SESSION,'sysmsg')) { }
if (x($_SESSION, 'sysmsg')) {
unset($_SESSION['sysmsg']); unset($_SESSION['sysmsg']);
} }
if (x($_SESSION,'sysmsg_info')) { if (x($_SESSION, 'sysmsg_info')) {
unset($_SESSION['sysmsg_info']); unset($_SESSION['sysmsg_info']);
} }