1
0
Fork 0

more coding convention applied:

- added curly braces
- added spaces where needed
- $r only needs to be tested with dbm::is_result()
- made SQL keywords all uper-case

Signed-off-by: Roland Häder <roland@mxchange.org>
This commit is contained in:
Roland Häder 2017-01-23 09:50:25 +01:00 committed by Roland Haeder
parent 1c6535c0b4
commit 63e4750b4a
No known key found for this signature in database
GPG key ID: B72F8185C6C7BD78
6 changed files with 38 additions and 26 deletions

View file

@ -136,8 +136,7 @@ function contacts_batch_actions(App $a) {
if (x($_SESSION,'return_url')) { if (x($_SESSION,'return_url')) {
goaway('' . $_SESSION['return_url']); goaway('' . $_SESSION['return_url']);
} } else {
else {
goaway('contacts'); goaway('contacts');
} }
@ -194,8 +193,10 @@ function contacts_post(App $a) {
$ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist'])); $ffi_keyword_blacklist = escape_tags(trim($_POST['ffi_keyword_blacklist']));
$priority = intval($_POST['poll']); $priority = intval($_POST['poll']);
if($priority > 5 || $priority < 0)
if ($priority > 5 || $priority < 0) {
$priority = 0; $priority = 0;
}
$info = escape_tags(trim($_POST['info'])); $info = escape_tags(trim($_POST['info']));
@ -212,17 +213,20 @@ function contacts_post(App $a) {
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
if($r) if ($r) {
info( t('Contact updated.') . EOL); info( t('Contact updated.') . EOL);
else } else {
notice( t('Failed to update contact record.') . EOL); notice( t('Failed to update contact record.') . EOL);
}
$r = q("select * from contact where id = %d and uid = %d limit 1", $r = q("SELECT * FROM `contact` WHERE `id` = %d AND `uid` = %d LIMIT 1",
intval($contact_id), intval($contact_id),
intval(local_user()) intval(local_user())
); );
if($r && dbm::is_result($r))
if (dbm::is_result($r)) {
$a->data['contact'] = $r[0]; $a->data['contact'] = $r[0];
}
return; return;

View file

@ -20,8 +20,9 @@ function crepair_init(App $a) {
} }
} }
if(! x($a->page,'aside')) if (! x($a->page,'aside')) {
$a->page['aside'] = ''; $a->page['aside'] = '';
}
if ($contact_id) { if ($contact_id) {
$a->data['contact'] = $r[0]; $a->data['contact'] = $r[0];
@ -35,6 +36,9 @@ function crepair_post(App $a) {
return; return;
} }
// Init $r here if $cid is not set
$r = false;
$cid = (($a->argc > 1) ? intval($a->argv[1]) : 0); $cid = (($a->argc > 1) ? intval($a->argv[1]) : 0);
if ($cid) { if ($cid) {
@ -85,11 +89,11 @@ function crepair_post(App $a) {
update_contact_avatar($photo,local_user(),$contact['id']); update_contact_avatar($photo,local_user(),$contact['id']);
} }
if($r) if ($r) {
info( t('Contact settings applied.') . EOL); info( t('Contact settings applied.') . EOL);
else } else {
notice( t('Contact update failed.') . EOL); notice( t('Contact update failed.') . EOL);
}
return; return;
} }

View file

@ -251,9 +251,10 @@ function message_content(App $a) {
// ); // );
//} //}
if($r) if ($r) {
info( t('Conversation removed.') . EOL ); info( t('Conversation removed.') . EOL );
} }
}
//goaway(App::get_baseurl(true) . '/message' ); //goaway(App::get_baseurl(true) . '/message' );
goaway($_SESSION['return_url']); goaway($_SESSION['return_url']);
} }

View file

@ -34,8 +34,9 @@ function profiles_init(App $a) {
intval($a->argv[2]), intval($a->argv[2]),
intval(local_user()) intval(local_user())
); );
if($r) if ($r) {
info(t('Profile deleted.').EOL); info(t('Profile deleted.').EOL);
}
goaway('profiles'); goaway('profiles');
return; // NOTREACHED return; // NOTREACHED
@ -473,8 +474,9 @@ function profiles_post(App $a) {
intval(local_user()) intval(local_user())
); );
if($r) if ($r) {
info( t('Profile updated.') . EOL); info( t('Profile updated.') . EOL);
}
if ($namechanged && $is_default) { if ($namechanged && $is_default) {

View file

@ -602,8 +602,9 @@ function settings_post(App $a) {
dbesc($language), dbesc($language),
intval(local_user()) intval(local_user())
); );
if($r) if ($r) {
info( t('Settings updated.') . EOL); info( t('Settings updated.') . EOL);
}
// clear session language // clear session language
unset($_SESSION['language']); unset($_SESSION['language']);

View file

@ -244,7 +244,7 @@ function wall_upload_post(App $a, $desktopmode = true) {
if (!$desktopmode) { if (!$desktopmode) {
$r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash); $r = q("SELECT `id`, `datasize`, `width`, `height`, `type` FROM `photo` WHERE `resource-id` = '%s' ORDER BY `width` DESC LIMIT 1", $hash);
if (!$r){ if (!dbm::is_result($r)) {
if ($r_json) { if ($r_json) {
echo json_encode(array('error'=>'')); echo json_encode(array('error'=>''));
killme(); killme();